Skip to content

Commit 4d93581

Browse files
authored
🐛 fix: report e2e commit status to fork PR head SHA (llm-d#831) (llm-d#840)
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 llm-d#831 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
1 parent 067c2d7 commit 4d93581

1 file changed

Lines changed: 69 additions & 1 deletion

File tree

.github/workflows/ci-pr-checks.yaml

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,23 @@ jobs:
271271
timeout-minutes: 60
272272
permissions:
273273
contents: read
274+
statuses: write # For reporting status on fork PR commits
274275
steps:
276+
- name: Set pending status on PR head
277+
if: github.event_name == 'issue_comment' && needs.check-code-changes.outputs.pr_head_sha != ''
278+
uses: actions/github-script@v7
279+
with:
280+
script: |
281+
await github.rest.repos.createCommitStatus({
282+
owner: context.repo.owner,
283+
repo: context.repo.repo,
284+
sha: '${{ needs.check-code-changes.outputs.pr_head_sha }}',
285+
state: 'pending',
286+
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
287+
description: 'E2E tests running...',
288+
context: '${{ github.workflow }} / e2e (comment trigger)'
289+
});
290+
275291
- name: Validate PR head SHA for issue_comment events
276292
if: github.event_name == 'issue_comment'
277293
run: |
@@ -320,10 +336,12 @@ jobs:
320336

321337
- name: Build WVA image locally
322338
id: build-image
339+
env:
340+
CHECKOUT_SHA: ${{ needs.check-code-changes.outputs.pr_head_sha || github.sha }}
323341
run: |
324342
# Generate unique image tag for this PR run (local image, no registry needed)
325343
IMAGE_NAME="llm-d-workload-variant-autoscaler"
326-
IMAGE_TAG="pr-${GITHUB_RUN_ID}-${GITHUB_SHA:0:7}"
344+
IMAGE_TAG="pr-${GITHUB_RUN_ID}-${CHECKOUT_SHA:0:7}"
327345
# Use localhost prefix for local-only image (Kind will load it directly)
328346
FULL_IMAGE="localhost/${IMAGE_NAME}:${IMAGE_TAG}"
329347
@@ -374,3 +392,53 @@ jobs:
374392
QUEUE_SPARE_TRIGGER: "4.5"
375393
run: |
376394
make ${{ steps.test-type.outputs.test_target }}
395+
396+
# Report status back to PR for issue_comment triggered runs
397+
# This ensures fork PRs show the correct status after /trigger-e2e-full runs complete
398+
report-status:
399+
runs-on: ubuntu-latest
400+
needs: [check-code-changes, check-full-tests, e2e-tests]
401+
if: always() && github.event_name == 'issue_comment' && needs.check-full-tests.outputs.run_full == 'true'
402+
permissions:
403+
statuses: write
404+
steps:
405+
- name: Report status to PR
406+
uses: actions/github-script@v7
407+
with:
408+
script: |
409+
const prHeadSha = '${{ needs.check-code-changes.outputs.pr_head_sha }}';
410+
const e2eResult = '${{ needs.e2e-tests.result }}';
411+
412+
if (!prHeadSha) {
413+
console.log('No PR head SHA available, skipping status report');
414+
return;
415+
}
416+
417+
let state, description;
418+
if (e2eResult === 'success') {
419+
state = 'success';
420+
description = 'E2E tests passed';
421+
} else if (e2eResult === 'skipped') {
422+
state = 'failure';
423+
description = 'E2E tests did not run (prerequisite failed or skipped)';
424+
} else if (e2eResult === 'cancelled') {
425+
state = 'failure';
426+
description = 'E2E tests cancelled';
427+
} else {
428+
state = 'failure';
429+
description = 'E2E tests failed';
430+
}
431+
432+
console.log(`Reporting status to PR commit ${prHeadSha}: ${state} - ${description}`);
433+
434+
await github.rest.repos.createCommitStatus({
435+
owner: context.repo.owner,
436+
repo: context.repo.repo,
437+
sha: prHeadSha,
438+
state: state,
439+
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
440+
description: description,
441+
context: '${{ github.workflow }} / e2e (comment trigger)'
442+
});
443+
444+
console.log('Status reported successfully');

0 commit comments

Comments
 (0)