Skip to content

ci: check out the workflow commit in the AI triage jobs - #4655

Merged
dolfim-ibm merged 1 commit into
mainfrom
ci/ai-triage-checkout-workflow-sha
Oct 8, 2026
Merged

dolfim-ibm merged 1 commit into
mainfrom
ci/ai-triage-checkout-workflow-sha

Conversation

@dolfim-ibm

Copy link
Copy Markdown
Member

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 current main. For #4622 this commit is older than #4639, so it has no triage scripts:

python3: can't open file '.github/scripts/ai_pr_triage.py': [Errno 2] No such file or directory

continue-on-error hid the failure, run_llm stayed empty, and analyze, publish, and the review were skipped. The run showed success, and the PR got no comment and no labels.

Fix

Check out github.sha in all five jobs. For pull_request_target, github.sha is 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-less git fetch as before. The merge base for the reference-data comparison still comes from the API, so it does not change.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Review evidence:

  • The log of run 37667879461 (fix(docx): keep w:sym characters and map Symbol font text to Unicode #4622, commit f81951f8) shows the error above in the prepare job, and all later jobs are skipped.
  • make validate: passed. The workflow YAML parses.
  • Not run: the fixed workflow on GitHub. A pull_request_target workflow runs from main, so the next push to an older PR after the merge tests it.

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>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @dolfim-ibm, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI bug Something isn't working labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 39268b01cc. The analysis read the diff only. It did not run code from this pull request.

This PR fixes the AI triage workflow so that all five jobs check out github.sha (the current base-branch HEAD) instead of github.event.pull_request.base.sha (the PR's original base commit). This ensures the workflow scripts are always present, even for PRs opened before the triage workflow was added.

Topic labels added: bug.

CI safety: needs maintainer care before you approve CI.

  • .github/workflows/ai-pr-triage.yml: changes CI workflows, actions, or CI scripts
  • .github/workflows/ai-pr-triage.yml: Changes CI workflow checkout references from the PR base SHA to github.sha; already flagged as forced finding.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 7, 2026
@dolfim-ibm dolfim-ibm changed the title fix(ci): check out the workflow commit in the AI triage jobs ci: check out the workflow commit in the AI triage jobs Oct 7, 2026
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@dolfim-ibm
dolfim-ibm merged commit 9590eb4 into main Oct 8, 2026
86 of 90 checks passed
@dolfim-ibm
dolfim-ibm deleted the ci/ai-triage-checkout-workflow-sha branch October 8, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-needs-care AI triage: check CI-safety findings before you approve CI ai:review-lgtm AI first review found no blocker or major issue (advisory) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants