Repository navigation
PR Comment #43679
Workflow file for this run
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
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # PR Analysis Report — posts/updates the analysis comment for ALL PRs. | |
| # | |
| # Runs on workflow_run after CI completes, NOT on pull_request. That matters: | |
| # a pull_request workflow triggered by a fork gets a READ-ONLY token and can't | |
| # comment, which is why the report never appeared on external-contributor PRs. | |
| # workflow_run runs from the base repo with the repo's own token (pull-requests: | |
| # write), so it can comment on fork PRs too — one code path for every PR, no | |
| # drift between a fork path and a same-repo path. | |
| # | |
| # Safety: resolves scope and PR identity from the GitHub API. Privileged jobs | |
| # check out only trusted default-branch code. Both preview URLs are resolved | |
| # from one exact-head Vercel deployment after route probes; the Pages result | |
| # remains a separate source-CI artifact, never a preview-link fallback. | |
| name: PR Comment | |
| on: | |
| workflow_run: | |
| workflows: ['CI'] | |
| types: [completed] | |
| deployment_status: | |
| permissions: {} | |
| jobs: | |
| resolve: | |
| if: github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| valid: ${{ steps.identity.outputs.valid }} | |
| pr_number: ${{ steps.identity.outputs.pr_number }} | |
| head_sha: ${{ steps.identity.outputs.head_sha }} | |
| head_repo: ${{ steps.identity.outputs.head_repo }} | |
| head_repo_id: ${{ steps.identity.outputs.head_repo_id }} | |
| head_ref: ${{ steps.identity.outputs.head_ref }} | |
| base_repo: ${{ steps.identity.outputs.base_repo }} | |
| base_sha: ${{ steps.identity.outputs.base_sha }} | |
| run_id: ${{ steps.identity.outputs.run_id }} | |
| run_attempt: ${{ steps.identity.outputs.run_attempt }} | |
| source_conclusion: ${{ steps.identity.outputs.source_conclusion }} | |
| spec_only: ${{ steps.identity.outputs.spec_only }} | |
| tooling_only: ${{ steps.identity.outputs.tooling_only }} | |
| failed: ${{ steps.checkout.outcome == 'failure' || steps.identity.outcome == 'failure' }} | |
| steps: | |
| - name: Checkout trusted default-branch code | |
| id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| - name: Resolve trusted PR identity | |
| continue-on-error: true | |
| id: identity | |
| # Steps continue on error, so a failed checkout no longer skips this | |
| # one by itself. | |
| if: steps.checkout.outcome == 'success' | |
| uses: actions/github-script@v9 | |
| with: | |
| retries: 3 | |
| script: | | |
| const {pathToFileURL} = require('node:url'); | |
| const {resolveWorkflowRunPullRequest} = await import( | |
| pathToFileURL(`${process.env.GITHUB_WORKSPACE}/.github/scripts/lib/pr-preview.mjs`).href | |
| ); | |
| const identity = await resolveWorkflowRunPullRequest({ | |
| github, | |
| ...context.repo, | |
| run: context.payload.workflow_run, | |
| }); | |
| if (identity === null) { | |
| core.notice( | |
| `Skipping source run ${context.payload.workflow_run.id}: no open pull request remains for this head.`, | |
| ); | |
| core.setOutput('valid', 'false'); | |
| return; | |
| } | |
| const path = require('node:path'); | |
| const {classifyChanges} = require(path.join( | |
| process.env.GITHUB_WORKSPACE, | |
| '.github/scripts/change-scope.cjs', | |
| )); | |
| const {data: pull} = await github.rest.pulls.get({ | |
| ...context.repo, | |
| pull_number: identity.prNumber, | |
| }); | |
| const files = await github.paginate(github.rest.pulls.listFiles, { | |
| ...context.repo, | |
| pull_number: identity.prNumber, | |
| per_page: 100, | |
| }); | |
| const changeScope = classifyChanges(files, { | |
| expectedCount: pull.changed_files, | |
| }); | |
| core.setOutput('valid', 'true'); | |
| core.setOutput('pr_number', String(identity.prNumber)); | |
| core.setOutput('head_sha', identity.headSha); | |
| core.setOutput('head_repo', identity.headRepository); | |
| core.setOutput('head_repo_id', identity.headRepositoryId); | |
| core.setOutput('head_ref', identity.headRef); | |
| core.setOutput('base_repo', identity.baseRepository); | |
| core.setOutput('base_sha', identity.baseSha); | |
| core.setOutput('run_id', String(identity.sourceRunId)); | |
| core.setOutput('run_attempt', String(identity.sourceRunAttempt)); | |
| core.setOutput('source_conclusion', identity.sourceConclusion); | |
| core.setOutput('spec_only', String(changeScope.specOnly)); | |
| core.setOutput('tooling_only', String(changeScope.toolingOnly)); | |
| resolve-preview: | |
| if: >- | |
| github.event_name == 'deployment_status' && | |
| github.event.deployment_status.state == 'success' && | |
| github.event.deployment.environment == 'Preview' && | |
| github.event.deployment.creator.login == 'vercel[bot]' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| deployments: read | |
| outputs: | |
| valid: ${{ steps.preview.outputs.valid }} | |
| pr_number: ${{ steps.preview.outputs.pr_number }} | |
| head_sha: ${{ steps.preview.outputs.head_sha }} | |
| origin: ${{ steps.preview.outputs.origin }} | |
| steps: | |
| - name: Checkout trusted default-branch code | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| - name: Check trusted resolver availability | |
| id: trusted | |
| run: | | |
| if [ -f .github/scripts/lib/vercel-preview.mjs ]; then | |
| echo "available=true" >> "$GITHUB_OUTPUT" | |
| else | |
| # A new deployment_status workflow can run before its helper lands | |
| # on main. Never load the untrusted PR branch as a substitute. | |
| echo "available=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice::Preview resolver is not on trusted main yet; skipping this deployment." | |
| fi | |
| - name: Resolve current Vercel PR preview | |
| id: preview | |
| if: steps.trusted.outputs.available == 'true' | |
| uses: actions/github-script@v9 | |
| with: | |
| retries: 3 | |
| script: | | |
| const {pathToFileURL} = require('node:url'); | |
| const {resolveVercelDeploymentEvent} = await import( | |
| pathToFileURL(`${process.env.GITHUB_WORKSPACE}/.github/scripts/lib/vercel-preview.mjs`).href | |
| ); | |
| const preview = await resolveVercelDeploymentEvent({ | |
| github, | |
| ...context.repo, | |
| deployment: context.payload.deployment, | |
| status: context.payload.deployment_status, | |
| }); | |
| if (!preview) { | |
| core.notice('No current, non-draft PR matches this exact Vercel Preview deployment.'); | |
| core.setOutput('valid', 'false'); | |
| return; | |
| } | |
| core.setOutput('valid', 'true'); | |
| core.setOutput('pr_number', String(preview.prNumber)); | |
| core.setOutput('head_sha', preview.headSha); | |
| core.setOutput('origin', preview.origin); | |
| preview-comment: | |
| needs: resolve-preview | |
| if: needs.resolve-preview.outputs.valid == 'true' | |
| concurrency: | |
| group: pr-report-${{ needs.resolve-preview.outputs.pr_number }} | |
| cancel-in-progress: false | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| deployments: read | |
| steps: | |
| - name: Checkout trusted default-branch code | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| - name: Post exact-head preview links before CI completes | |
| uses: actions/github-script@v9 | |
| env: | |
| PR_NUMBER: ${{ needs.resolve-preview.outputs.pr_number }} | |
| HEAD_SHA: ${{ needs.resolve-preview.outputs.head_sha }} | |
| PREVIEW_ORIGIN: ${{ needs.resolve-preview.outputs.origin }} | |
| with: | |
| retries: 3 | |
| script: | | |
| const {pathToFileURL} = require('node:url'); | |
| const {reconcileEarlyPreviewComment} = await import( | |
| pathToFileURL(`${process.env.GITHUB_WORKSPACE}/.github/scripts/lib/pr-preview.mjs`).href | |
| ); | |
| await reconcileEarlyPreviewComment({ | |
| github, | |
| ...context.repo, | |
| prNumber: Number(process.env.PR_NUMBER), | |
| headSha: process.env.HEAD_SHA, | |
| origin: process.env.PREVIEW_ORIGIN, | |
| }); | |
| spec-only-reconcile: | |
| needs: resolve | |
| concurrency: | |
| group: pr-report-${{ needs.resolve.outputs.pr_number }} | |
| cancel-in-progress: false | |
| if: >- | |
| github.event.action == 'completed' && | |
| needs.resolve.outputs.valid == 'true' && | |
| (needs.resolve.outputs.spec_only == 'true' || | |
| needs.resolve.outputs.tooling_only == 'true') | |
| runs-on: ubuntu-slim | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: write | |
| outputs: | |
| failed: ${{ steps.scope.outcome == 'failure' || steps.checkout.outcome == 'failure' || steps.reconcile.outcome == 'failure' }} | |
| steps: | |
| - name: Report no visual scope | |
| id: scope | |
| continue-on-error: true | |
| run: echo 'No visual scope applies; canonical visual checks are not applicable.' >> "$GITHUB_STEP_SUMMARY" | |
| - name: Checkout trusted default-branch code | |
| id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| - name: Remove stale preview links from an existing report | |
| id: reconcile | |
| continue-on-error: true | |
| if: steps.checkout.outcome == 'success' | |
| uses: actions/github-script@v9 | |
| env: | |
| PR_NUMBER: ${{ needs.resolve.outputs.pr_number }} | |
| HEAD_SHA: ${{ needs.resolve.outputs.head_sha }} | |
| HEAD_REPOSITORY: ${{ needs.resolve.outputs.head_repo }} | |
| HEAD_REPOSITORY_ID: ${{ needs.resolve.outputs.head_repo_id }} | |
| HEAD_REF: ${{ needs.resolve.outputs.head_ref }} | |
| BASE_REPOSITORY: ${{ needs.resolve.outputs.base_repo }} | |
| BASE_SHA: ${{ needs.resolve.outputs.base_sha }} | |
| RUN_ID: ${{ needs.resolve.outputs.run_id }} | |
| RUN_ATTEMPT: ${{ needs.resolve.outputs.run_attempt }} | |
| SOURCE_CONCLUSION: ${{ needs.resolve.outputs.source_conclusion }} | |
| with: | |
| retries: 3 | |
| script: | | |
| const {pathToFileURL} = require('node:url'); | |
| const {reconcilePrComment} = await import( | |
| pathToFileURL(`${process.env.GITHUB_WORKSPACE}/.github/scripts/lib/pr-preview.mjs`).href | |
| ); | |
| await reconcilePrComment({ | |
| github, | |
| core, | |
| context, | |
| expectedIdentity: { | |
| prNumber: Number(process.env.PR_NUMBER), | |
| headSha: process.env.HEAD_SHA, | |
| headRepository: process.env.HEAD_REPOSITORY, | |
| headRepositoryId: process.env.HEAD_REPOSITORY_ID, | |
| headRef: process.env.HEAD_REF, | |
| baseRepository: process.env.BASE_REPOSITORY, | |
| baseSha: process.env.BASE_SHA, | |
| sourceRunId: Number(process.env.RUN_ID), | |
| sourceRunAttempt: Number(process.env.RUN_ATTEMPT), | |
| sourceConclusion: process.env.SOURCE_CONCLUSION, | |
| }, | |
| createIfMissing: false, | |
| fallbackMessage: | |
| 'The current change has no visual or preview-producing scope. Visual checks are not applicable; preview links are not shown.', | |
| }); | |
| comment: | |
| needs: resolve | |
| concurrency: | |
| group: pr-report-${{ needs.resolve.outputs.pr_number }} | |
| cancel-in-progress: false | |
| # Only the exact-head Vercel deployment supplies Storybook and Sandbox PR links. | |
| # Visual evidence remains attached to the exact CI run. | |
| if: >- | |
| always() && | |
| github.event.action == 'completed' && | |
| needs.resolve.outputs.valid == 'true' && | |
| needs.resolve.outputs.spec_only != 'true' && | |
| needs.resolve.outputs.tooling_only != 'true' | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| pull-requests: write | |
| actions: read | |
| deployments: read # resolve the exact-head Vercel Preview deployment | |
| # The artifact downloads are optional (a run may not produce them), so | |
| # they are not failures of this job. | |
| outputs: | |
| failed: >- | |
| ${{ steps.checkout.outcome == 'failure' || | |
| steps.setup.outcome == 'failure' || | |
| steps.identity.outcome == 'failure' || | |
| steps.cross-check.outcome == 'failure' || | |
| steps.visual.outcome == 'failure' || | |
| steps.publish.outcome == 'failure' }} | |
| steps: | |
| - name: Checkout trusted default-branch code | |
| id: checkout | |
| continue-on-error: true | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| - name: Setup Node and pnpm | |
| id: setup | |
| continue-on-error: true | |
| uses: ./.github/actions/setup | |
| # Recheck the exact source run and current PR immediately before any | |
| # privileged report or status mutation. | |
| - name: Reconfirm trusted PR identity | |
| continue-on-error: true | |
| id: identity | |
| # Steps continue on error, so a failed checkout or install no longer | |
| # skips the rest by itself. Every later step requires a valid identity. | |
| if: steps.setup.outcome == 'success' | |
| uses: actions/github-script@v9 | |
| env: | |
| PR_NUMBER: ${{ needs.resolve.outputs.pr_number }} | |
| HEAD_SHA: ${{ needs.resolve.outputs.head_sha }} | |
| HEAD_REPOSITORY: ${{ needs.resolve.outputs.head_repo }} | |
| HEAD_REPOSITORY_ID: ${{ needs.resolve.outputs.head_repo_id }} | |
| HEAD_REF: ${{ needs.resolve.outputs.head_ref }} | |
| BASE_REPOSITORY: ${{ needs.resolve.outputs.base_repo }} | |
| SOURCE_RUN_ID: ${{ needs.resolve.outputs.run_id }} | |
| SOURCE_RUN_ATTEMPT: ${{ needs.resolve.outputs.run_attempt }} | |
| SOURCE_CONCLUSION: ${{ needs.resolve.outputs.source_conclusion }} | |
| with: | |
| retries: 3 | |
| script: | | |
| const {pathToFileURL} = require('node:url'); | |
| const {confirmOrStandDown} = await import( | |
| pathToFileURL(`${process.env.GITHUB_WORKSPACE}/.github/scripts/lib/pr-preview.mjs`).href | |
| ); | |
| const identity = await confirmOrStandDown({ | |
| github, | |
| core, | |
| ...context.repo, | |
| expected: { | |
| prNumber: Number(process.env.PR_NUMBER), | |
| headSha: process.env.HEAD_SHA, | |
| headRepository: process.env.HEAD_REPOSITORY, | |
| headRepositoryId: process.env.HEAD_REPOSITORY_ID, | |
| headRef: process.env.HEAD_REF, | |
| baseRepository: process.env.BASE_REPOSITORY, | |
| sourceRunId: Number(process.env.SOURCE_RUN_ID), | |
| sourceRunAttempt: Number(process.env.SOURCE_RUN_ATTEMPT), | |
| sourceConclusion: process.env.SOURCE_CONCLUSION, | |
| }, | |
| }); | |
| if (identity === null) { | |
| core.setOutput('valid', 'false'); | |
| return; | |
| } | |
| core.setOutput('valid', 'true'); | |
| core.setOutput('pr_number', String(identity.prNumber)); | |
| core.setOutput('head_sha', identity.headSha); | |
| core.setOutput('head_repo', identity.headRepository); | |
| core.setOutput('head_repo_id', identity.headRepositoryId); | |
| core.setOutput('head_ref', identity.headRef); | |
| core.setOutput('base_repo', identity.baseRepository); | |
| core.setOutput('base_sha', identity.baseSha); | |
| core.setOutput('run_id', String(identity.sourceRunId)); | |
| core.setOutput('run_attempt', String(identity.sourceRunAttempt)); | |
| core.setOutput('source_conclusion', identity.sourceConclusion); | |
| - name: Download analysis artifact from the CI run | |
| if: steps.identity.outputs.valid == 'true' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: pr-analysis | |
| path: pr-analysis | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| continue-on-error: true | |
| - name: Download base size stats from the CI run | |
| if: steps.identity.outputs.valid == 'true' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: pr-size-base | |
| path: pr-size-base | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| continue-on-error: true | |
| - name: Download a11y artifact from the CI run | |
| if: steps.identity.outputs.valid == 'true' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: a11y-report | |
| path: a11y | |
| run-id: ${{ github.event.workflow_run.id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| continue-on-error: true | |
| - name: Download canonical visual report | |
| id: visual-download | |
| if: steps.identity.outputs.valid == 'true' | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: visual-pr-report | |
| path: visual-pr-report | |
| run-id: ${{ steps.identity.outputs.run_id }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| continue-on-error: true | |
| - name: Cross-check artifact identity | |
| id: cross-check | |
| continue-on-error: true | |
| if: steps.identity.outputs.valid == 'true' && hashFiles('pr-analysis/pr-meta.json') != '' | |
| env: | |
| EXPECTED_PR: ${{ steps.identity.outputs.pr_number }} | |
| EXPECTED_HEAD: ${{ steps.identity.outputs.head_sha }} | |
| EXPECTED_HEAD_REPO: ${{ steps.identity.outputs.head_repo }} | |
| EXPECTED_BASE_REPO: ${{ steps.identity.outputs.base_repo }} | |
| EXPECTED_RUN: ${{ steps.identity.outputs.run_id }} | |
| EXPECTED_ATTEMPT: ${{ steps.identity.outputs.run_attempt }} | |
| run: | | |
| node --input-type=module - <<'NODE' | |
| import fs from 'node:fs'; | |
| import {validateAnalysisMetadata} from './.github/scripts/lib/pr-preview.mjs'; | |
| const metadata = JSON.parse(fs.readFileSync('pr-analysis/pr-meta.json', 'utf8')); | |
| validateAnalysisMetadata(metadata, { | |
| prNumber: process.env.EXPECTED_PR, | |
| headSha: process.env.EXPECTED_HEAD, | |
| headRepository: process.env.EXPECTED_HEAD_REPO, | |
| baseRepository: process.env.EXPECTED_BASE_REPO, | |
| sourceRunId: process.env.EXPECTED_RUN, | |
| sourceRunAttempt: process.env.EXPECTED_ATTEMPT, | |
| }); | |
| NODE | |
| # Only JSON and re-encoded PNGs from the exact CI attempt are published. | |
| # No browser, baseline comparison, acceptance, or status authority lives here. | |
| - name: Prepare canonical visual report | |
| id: visual | |
| continue-on-error: true | |
| if: steps.identity.outputs.valid == 'true' && steps.visual-download.outcome == 'success' | |
| env: | |
| HEAD_SHA: ${{ steps.identity.outputs.head_sha }} | |
| RUN_ID: ${{ steps.identity.outputs.run_id }} | |
| RUN_ATTEMPT: ${{ steps.identity.outputs.run_attempt }} | |
| run: | | |
| node .github/scripts/visual-gate/publish-pr-report.mjs \ | |
| --input visual-pr-report \ | |
| --output trusted-visual \ | |
| --head-sha "$HEAD_SHA" \ | |
| --run-id "$RUN_ID" \ | |
| --run-attempt "$RUN_ATTEMPT" | |
| - name: Generate and post PR comment | |
| id: publish | |
| continue-on-error: true | |
| if: always() && steps.identity.outputs.valid == 'true' | |
| uses: actions/github-script@v9 | |
| env: | |
| PR_NUMBER: ${{ steps.identity.outputs.pr_number }} | |
| HEAD_SHA: ${{ steps.identity.outputs.head_sha }} | |
| HEAD_REPOSITORY: ${{ steps.identity.outputs.head_repo }} | |
| HEAD_REPOSITORY_ID: ${{ steps.identity.outputs.head_repo_id }} | |
| HEAD_REF: ${{ steps.identity.outputs.head_ref }} | |
| BASE_REPOSITORY: ${{ steps.identity.outputs.base_repo }} | |
| BASE_SHA: ${{ steps.identity.outputs.base_sha }} | |
| RUN_ID: ${{ steps.identity.outputs.run_id }} | |
| RUN_ATTEMPT: ${{ steps.identity.outputs.run_attempt }} | |
| SOURCE_CONCLUSION: ${{ steps.identity.outputs.source_conclusion }} | |
| with: | |
| retries: 3 | |
| script: | | |
| const {pathToFileURL} = require('node:url'); | |
| const {reconcilePrComment} = await import( | |
| pathToFileURL(`${process.env.GITHUB_WORKSPACE}/.github/scripts/lib/pr-preview.mjs`).href | |
| ); | |
| await reconcilePrComment({ | |
| github, | |
| core, | |
| context, | |
| expectedIdentity: { | |
| prNumber: Number(process.env.PR_NUMBER), | |
| headSha: process.env.HEAD_SHA, | |
| headRepository: process.env.HEAD_REPOSITORY, | |
| headRepositoryId: process.env.HEAD_REPOSITORY_ID, | |
| headRef: process.env.HEAD_REF, | |
| baseRepository: process.env.BASE_REPOSITORY, | |
| baseSha: process.env.BASE_SHA, | |
| sourceRunId: Number(process.env.RUN_ID), | |
| sourceRunAttempt: Number(process.env.RUN_ATTEMPT), | |
| sourceConclusion: process.env.SOURCE_CONCLUSION, | |
| }, | |
| }); | |
| # The CI-completion lane runs on workflow_run, so GitHub attaches its jobs to | |
| # main's latest commit. Main's checks must show main's health, not a pull | |
| # request's. The jobs above therefore never fail the run: every fallible step | |
| # continues on error, and this job reports their outcome as the PR Comment | |
| # status on the pull request's own head. (The deployment_status lane already | |
| # runs on the pull request's head commit.) | |
| report: | |
| needs: [resolve, spec-only-reconcile, comment] | |
| if: >- | |
| always() && | |
| github.event_name == 'workflow_run' && | |
| github.event.workflow_run.event == 'pull_request' && | |
| (needs.resolve.outputs.valid == 'true' || | |
| needs.resolve.outputs.failed == 'true') | |
| runs-on: ubuntu-slim | |
| permissions: | |
| statuses: write | |
| steps: | |
| - name: Report the outcome on the pull request head | |
| continue-on-error: true | |
| uses: actions/github-script@v9 | |
| env: | |
| # The source run's head is the pull request head it tested, taken from | |
| # the trusted event rather than from any job output. | |
| HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | |
| FAILED: >- | |
| ${{ needs.resolve.outputs.failed == 'true' || | |
| needs.spec-only-reconcile.outputs.failed == 'true' || | |
| needs.comment.outputs.failed == 'true' || | |
| contains(needs.*.result, 'failure') || | |
| contains(needs.*.result, 'cancelled') }} | |
| with: | |
| retries: 3 | |
| script: | | |
| const failed = process.env.FAILED === 'true'; | |
| await github.rest.repos.createCommitStatus({ | |
| ...context.repo, | |
| sha: process.env.HEAD_SHA, | |
| context: 'PR Comment', | |
| state: failed ? 'failure' : 'success', | |
| target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
| description: failed | |
| ? 'A PR report step failed or was cancelled. See the run.' | |
| : 'No PR report step failed.', | |
| }); |