From ea3538a2a2f035b450ddbce5f2da2fc2b5201878 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Wed, 4 Mar 2026 12:12:05 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20report=20e2e=20commit=20s?= =?UTF-8?q?tatus=20to=20fork=20PR=20head=20SHA=20(#831)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When /trigger-e2e-full is commented on a fork PR, the issue_comment event always associates the workflow run with main (GitHub limitation). Without explicit status reporting, the PR shows no e2e check status, making it appear the tests ran against main. Fix: - Add report-status job that calls repos.createCommitStatus on the PR head SHA after e2e-tests complete (mirrors ci-e2e-openshift.yaml) - Add pending status step at e2e-tests start for immediate PR feedback - Replace GITHUB_SHA with pr_head_sha in image tag so logs show the actual code being tested - Add statuses:write permission to e2e-tests and report-status jobs Closes #831 Signed-off-by: Andrew Anderson --- .github/workflows/ci-pr-checks.yaml | 70 ++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-pr-checks.yaml b/.github/workflows/ci-pr-checks.yaml index fc17fafa2..4830c1a30 100644 --- a/.github/workflows/ci-pr-checks.yaml +++ b/.github/workflows/ci-pr-checks.yaml @@ -271,7 +271,23 @@ jobs: timeout-minutes: 60 permissions: contents: read + statuses: write # For reporting status on fork PR commits steps: + - name: Set pending status on PR head + if: github.event_name == 'issue_comment' && needs.check-code-changes.outputs.pr_head_sha != '' + uses: actions/github-script@v7 + with: + script: | + await github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: '${{ needs.check-code-changes.outputs.pr_head_sha }}', + state: 'pending', + target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, + description: 'E2E tests running...', + context: '${{ github.workflow }} / e2e (comment trigger)' + }); + - name: Validate PR head SHA for issue_comment events if: github.event_name == 'issue_comment' run: | @@ -320,10 +336,12 @@ jobs: - name: Build WVA image locally id: build-image + env: + CHECKOUT_SHA: ${{ needs.check-code-changes.outputs.pr_head_sha || github.sha }} run: | # Generate unique image tag for this PR run (local image, no registry needed) IMAGE_NAME="llm-d-workload-variant-autoscaler" - IMAGE_TAG="pr-${GITHUB_RUN_ID}-${GITHUB_SHA:0:7}" + IMAGE_TAG="pr-${GITHUB_RUN_ID}-${CHECKOUT_SHA:0:7}" # Use localhost prefix for local-only image (Kind will load it directly) FULL_IMAGE="localhost/${IMAGE_NAME}:${IMAGE_TAG}" @@ -374,3 +392,53 @@ jobs: QUEUE_SPARE_TRIGGER: "4.5" run: | make ${{ steps.test-type.outputs.test_target }} + + # Report status back to PR for issue_comment triggered runs + # This ensures fork PRs show the correct status after /trigger-e2e-full runs complete + report-status: + runs-on: ubuntu-latest + needs: [check-code-changes, check-full-tests, e2e-tests] + if: always() && github.event_name == 'issue_comment' && needs.check-full-tests.outputs.run_full == 'true' + permissions: + statuses: write + steps: + - name: Report status to PR + uses: actions/github-script@v7 + with: + script: | + const prHeadSha = '${{ needs.check-code-changes.outputs.pr_head_sha }}'; + const e2eResult = '${{ needs.e2e-tests.result }}'; + + if (!prHeadSha) { + console.log('No PR head SHA available, skipping status report'); + return; + } + + let state, description; + if (e2eResult === 'success') { + state = 'success'; + description = 'E2E tests passed'; + } else if (e2eResult === 'skipped') { + state = 'failure'; + description = 'E2E tests did not run (prerequisite failed or skipped)'; + } else if (e2eResult === 'cancelled') { + state = 'failure'; + description = 'E2E tests cancelled'; + } else { + state = 'failure'; + description = 'E2E tests failed'; + } + + console.log(`Reporting status to PR commit ${prHeadSha}: ${state} - ${description}`); + + await github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: prHeadSha, + state: state, + target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, + description: description, + context: '${{ github.workflow }} / e2e (comment trigger)' + }); + + console.log('Status reported successfully');