Repository navigation
ci: check out the workflow commit in the AI triage jobs - #4655
Conversation
The AI triage jobs checked out github.event.pull_request.base.sha. For a PR opened before the triage was merged, that base commit does not contain the triage scripts, so `prepare` failed with "can't open file .github/scripts/ai_pr_triage.py". continue-on-error hid the failure and all later jobs were skipped (for example on #4622). Check out github.sha instead. For pull_request_target, this is the current head of the base branch, the same commit as the running workflow file, so the workflow and its scripts always match. It is still trusted code: no job checks out code from the PR. Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
|
✅ DCO Check Passed Thanks @dolfim-ibm, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit This PR fixes the AI triage workflow so that all five jobs check out Topic labels added: CI safety: needs maintainer care before you approve CI.
The |
There was a problem hiding this comment.
AI first review (advisory): no blocking issue found
This review covers the full diff at 39268b01cc. It read the code only. It did not run tests or code from this pull request.
The PR fixes a silent CI failure: all five checkout steps used github.event.pull_request.base.sha instead of github.sha. For PRs opened before the triage scripts were merged, that older commit contains no triage scripts, so every job after prepare silently skips. The fix replaces all five refs with github.sha, which always resolves to the current main head that is also running this workflow. The change is minimal and the security model is unchanged: no job checks out code from the PR branch.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The AI triage did not run on PRs opened before the triage was merged, for example #4622.
Cause
Every job checked out
github.event.pull_request.base.sha. This is the base commit that GitHub stores for the PR, not the currentmain. For #4622 this commit is older than #4639, so it has no triage scripts:continue-on-errorhid the failure,run_llmstayed empty, andanalyze,publish, and the review were skipped. The run showedsuccess, and the PR got no comment and no labels.Fix
Check out
github.shain all five jobs. Forpull_request_target,github.shais the current head of the base branch, which is the same commit as the running workflow file. The workflow and its scripts then always match, also after later changes to the scripts. This is still trusted code: no job checks out code from the PR. The PR is read through the API and blob-lessgit fetchas before. The merge base for the reference-data comparison still comes from the API, so it does not change.Checklist:
Review evidence:
f81951f8) shows the error above in thepreparejob, and all later jobs are skipped.make validate: passed. The workflow YAML parses.pull_request_targetworkflow runs frommain, so the next push to an older PR after the merge tests it.