Skip to content

fix: support fork PRs in commit-recordings workflow#5204

Merged
cdoern merged 3 commits intollamastack:mainfrom
cdoern:fix-fork-pr-recordings
Mar 19, 2026
Merged

fix: support fork PRs in commit-recordings workflow#5204
cdoern merged 3 commits intollamastack:mainfrom
cdoern:fix-fork-pr-recordings

Conversation

@cdoern
Copy link
Collaborator

@cdoern cdoern commented Mar 18, 2026

Summary

  • Fix empty headRepository.nameWithOwner from gh pr view for fork PRs by constructing repo name from headRepositoryOwner.login/headRepository.name
  • Split checkout in commit-recordings into same-repo and fork paths since github.token cannot clone fork repos
  • Use RELEASE_PAT (classic PAT with repo scope) for fork checkout and push, as maintainerCanModify requires a maintainer's credentials
  • Preserve recording artifacts across checkout by moving to /tmp

Test plan

  • Verified headRepository.nameWithOwner is empty for all PRs via gh pr view
  • Verified new headRepositoryOwner.login/headRepository.name construction works for both fork and same-repo PRs
  • Verified artifact preserve/restore round-trip
  • Run workflow_dispatch on a fork PR to validate end-to-end

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 18, 2026
Comment on lines +161 to +170
- name: Checkout PR branch (same-repo)
if: steps.pr-info.outputs.skip != 'true' && steps.pr-info.outputs.is_fork_pr != 'true'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ steps.pr-info.outputs.head_repo }}
ref: ${{ steps.pr-info.outputs.head_ref }}
fetch-depth: 0
token: ${{ github.token }}

- name: Restore artifacts after checkout

Check failure

Code scanning / CodeQL

Checkout of untrusted code in trusted context High

Potential execution of untrusted code on a privileged workflow (
workflow_run
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a false positive. The workflow_run checkout is only used to get the branch state for committing recording files on top of. No code from the checkout is executed - the subsequent steps only run cp, git add, git commit, and git push. The recording files themselves are generated by the unprivileged pull_request-triggered workflow and passed via artifacts

- Fix empty headRepository.nameWithOwner for fork PRs by constructing
  repo name from headRepositoryOwner.login/headRepository.name
- Split checkout into same-repo and fork paths since github.token
  cannot clone fork repos
- Use RELEASE_PAT for fork checkout and push (repo scope needed)
- Preserve recording artifacts across checkout (moved to /tmp)

Signed-off-by: Charlie Doern <cdoern@redhat.com>
@cdoern cdoern force-pushed the fix-fork-pr-recordings branch from b5e64c7 to 6931c36 Compare March 19, 2026 13:06
@cdoern cdoern marked this pull request as ready for review March 19, 2026 13:21
@cdoern cdoern merged commit bb48bd1 into llamastack:main Mar 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants