Repository navigation
Stage results for PR #3928
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Stage PR Results | |
| run-name: Stage results for PR #${{ github.event.issue.number }} | |
| on: | |
| issue_comment: | |
| types: [created] | |
| permissions: {} | |
| concurrency: | |
| group: stage-results-pr-${{ github.event.issue.number }} | |
| cancel-in-progress: false | |
| jobs: | |
| dispatch: | |
| name: Authorize and dispatch staging | |
| if: >- | |
| github.event.issue.pull_request && | |
| (startsWith(github.event.comment.body, '/stage-results') || | |
| startsWith(github.event.comment.body, '/use')) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read # Validate the source workflow run and its artifacts | |
| contents: read # Resolve pull-request commits | |
| issues: read # Read labels and label-history timeline events | |
| pull-requests: write # Post staging status as github-actions rather than a PAT user | |
| steps: | |
| - name: Checkout trusted workflow code | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ github.sha }} | |
| persist-credentials: false | |
| - name: Select Python project | |
| run: | | |
| python_project="$GITHUB_WORKSPACE" | |
| if [[ -f "$python_project/inferencex-e2e/pyproject.toml" ]]; then | |
| python_project="$python_project/inferencex-e2e" | |
| fi | |
| test -f "$python_project/pyproject.toml" | |
| echo "INFERENCEX_PYTHON_PROJECT=$python_project" >> "$GITHUB_ENV" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| cache-dependency-glob: | | |
| pyproject.toml | |
| uv.lock | |
| inferencex-e2e/pyproject.toml | |
| inferencex-e2e/uv.lock | |
| - name: Authorize request and resolve source run | |
| id: request | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: uv run --project "$INFERENCEX_PYTHON_PROJECT" --locked python -m infx.workflows.stage_results | |
| - name: Acknowledge staging request | |
| if: steps.request.outputs.run-id != '' | |
| id: acknowledge | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| env: | |
| RUN_ID: ${{ steps.request.outputs.run-id }} | |
| RUN_URL: ${{ steps.request.outputs.run-url }} | |
| REQUESTED_BY: ${{ steps.request.outputs.requested-by }} | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| const body = `@${process.env.REQUESTED_BY} staging [run ${process.env.RUN_ID}](${process.env.RUN_URL}). Existing staged runs will be preserved; a completion link will be posted here.`; | |
| const comment = await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| core.setOutput('comment-id', String(comment.data.id)); | |
| - name: Dispatch InferenceX-app staging workflow | |
| if: steps.request.outputs.run-id != '' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| env: | |
| RUN_ID: ${{ steps.request.outputs.run-id }} | |
| RUN_ATTEMPT: ${{ steps.request.outputs.run-attempt }} | |
| RUN_DATE: ${{ steps.request.outputs.run-date }} | |
| REQUESTED_BY: ${{ steps.request.outputs.requested-by }} | |
| COMMENT_ID: ${{ steps.acknowledge.outputs.comment-id }} | |
| with: | |
| # Cross-repository dispatch credential; trusted control code validates maintainer authorization. | |
| github-token: ${{ secrets.FRONTEND_PAT }} # zizmor: ignore[secrets-outside-env] | |
| script: | | |
| await github.rest.repos.createDispatchEvent({ | |
| owner: 'SemiAnalysisAI', | |
| repo: 'InferenceX-app', | |
| event_type: 'stage-results', | |
| client_payload: { | |
| 'source-repository': `${context.repo.owner}/${context.repo.repo}`, | |
| 'pr-number': String(context.issue.number), | |
| 'run-id': process.env.RUN_ID, | |
| 'run-attempt': process.env.RUN_ATTEMPT, | |
| 'run-date': process.env.RUN_DATE, | |
| 'requested-by': process.env.REQUESTED_BY, | |
| 'comment-id': process.env.COMMENT_ID, | |
| }, | |
| }); |