|
44 | 44 | types: [labeled] |
45 | 45 | workflow_dispatch: |
46 | 46 | inputs: |
| 47 | + bootstrap_hosted_model: |
| 48 | + description: Transfer the existing hosted model secret to the Midscene App |
| 49 | + type: boolean |
| 50 | + required: false |
| 51 | + default: false |
47 | 52 | project: |
48 | 53 | description: Run one Midscene project for focused verification |
49 | 54 | type: choice |
@@ -94,9 +99,49 @@ concurrency: |
94 | 99 | cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
95 | 100 |
|
96 | 101 | jobs: |
| 102 | + bootstrap-hosted-model: |
| 103 | + name: Bootstrap hosted model |
| 104 | + if: github.event_name == 'workflow_dispatch' && inputs.bootstrap_hosted_model == true && github.actor == 'quanru' && github.ref == 'refs/heads/research/omarchy-plugin-visual-review' |
| 105 | + runs-on: ubuntu-latest |
| 106 | + timeout-minutes: 5 |
| 107 | + env: |
| 108 | + MIDSCENE_REVIEW_APP_URL: ${{ vars.MIDSCENE_REVIEW_APP_URL }} |
| 109 | + HOSTED_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }} |
| 110 | + HOSTED_MODEL_NAME: ${{ secrets.MIDSCENE_MODEL_NAME }} |
| 111 | + HOSTED_MODEL_BASE_URL: ${{ secrets.MIDSCENE_MODEL_BASE_URL }} |
| 112 | + HOSTED_MODEL_FAMILY: ${{ secrets.MIDSCENE_MODEL_FAMILY }} |
| 113 | + steps: |
| 114 | + - name: Transfer hosted model configuration over OIDC-authenticated HTTPS |
| 115 | + run: | |
| 116 | + test -n "$MIDSCENE_REVIEW_APP_URL" |
| 117 | + test -n "$HOSTED_MODEL_API_KEY" |
| 118 | + test -n "$HOSTED_MODEL_NAME" |
| 119 | + test -n "$HOSTED_MODEL_BASE_URL" |
| 120 | + test -n "$HOSTED_MODEL_FAMILY" |
| 121 | + node --input-type=module <<'JS' |
| 122 | + const identityResponse = await fetch(`${process.env.ACTIONS_ID_TOKEN_REQUEST_URL}&audience=midscene-review-app`, { |
| 123 | + headers: { authorization: `bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}` }, |
| 124 | + }); |
| 125 | + if (!identityResponse.ok) throw new Error(`GitHub OIDC failed: ${identityResponse.status}`); |
| 126 | + const { value: identity } = await identityResponse.json(); |
| 127 | + const response = await fetch(`${process.env.MIDSCENE_REVIEW_APP_URL.replace(/\/+$/, '')}/api/worker/bootstrap-hosted`, { |
| 128 | + method: 'POST', |
| 129 | + headers: { authorization: `Bearer ${identity}`, 'content-type': 'application/json' }, |
| 130 | + body: JSON.stringify({ |
| 131 | + apiKey: process.env.HOSTED_MODEL_API_KEY, |
| 132 | + modelName: process.env.HOSTED_MODEL_NAME, |
| 133 | + baseUrl: process.env.HOSTED_MODEL_BASE_URL, |
| 134 | + modelFamily: process.env.HOSTED_MODEL_FAMILY, |
| 135 | + }), |
| 136 | + }); |
| 137 | + if (!response.ok) throw new Error(`Midscene bootstrap failed: ${response.status}`); |
| 138 | + console.log('Hosted model configuration was stored by the Midscene review service.'); |
| 139 | + JS |
| 140 | +
|
97 | 141 | omarchy-e2e: |
98 | 142 | name: Midscene visual (${{ matrix.project }}) |
99 | 143 | if: >- |
| 144 | + inputs.bootstrap_hosted_model != true && |
100 | 145 | (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && |
101 | 146 | (github.event_name != 'issues' || |
102 | 147 | (github.event.label.name == 'midscene-review' && startsWith(github.event.issue.title, '[Omarchy review] '))) |
@@ -344,7 +389,7 @@ jobs: |
344 | 389 | name: Assemble Midscene report bundle |
345 | 390 | needs: omarchy-e2e |
346 | 391 | if: >- |
347 | | - always() && !cancelled() && github.event_name != 'issues' && |
| 392 | + always() && !cancelled() && github.event_name != 'issues' && inputs.bootstrap_hosted_model != true && |
348 | 393 | (inputs.project == '' || inputs.project == 'all') |
349 | 394 | runs-on: ubuntu-latest |
350 | 395 | outputs: |
@@ -380,7 +425,7 @@ jobs: |
380 | 425 | name: GitHub Pages report |
381 | 426 | needs: [omarchy-e2e, report-bundle] |
382 | 427 | if: >- |
383 | | - always() && github.event_name != 'issues' && |
| 428 | + always() && github.event_name != 'issues' && inputs.bootstrap_hosted_model != true && |
384 | 429 | !cancelled() && |
385 | 430 | needs.report-bundle.outputs.report-artifact-id != '' && |
386 | 431 | (github.event_name != 'pull_request' || |
|
0 commit comments