Skip to content

Fix label workflow failing on fork PRs with actions/checkout v7#51199

Merged
ahus1 merged 2 commits into
mainfrom
copilot/fix-failing-github-actions-job-label
Jul 27, 2026
Merged

Fix label workflow failing on fork PRs with actions/checkout v7#51199
ahus1 merged 2 commits into
mainfrom
copilot/fix-failing-github-actions-job-label

Conversation

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Closes #51201

actions/checkout@v7 introduced an explicit security guard that refuses to check out fork code in a pull_request_target workflow without allow-unsafe-pr-checkout: true, causing the label job to fail for all fork PRs.

Changes

  • Add ref: ${{ github.event.pull_request.base.sha }} to the checkout step in label.yml so it fetches .github/scripts from the base repo only — the correct and safe behavior, since the labeller script only calls the GitHub API and never executes fork code.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job label Fix label workflow failing on fork PRs with actions/checkout v7 Jul 27, 2026
Copilot finished work on behalf of ahus1 July 27, 2026 13:45
Copilot AI requested a review from ahus1 July 27, 2026 13:45
@ahus1
ahus1 marked this pull request as ready for review July 27, 2026 13:49
@ahus1
ahus1 requested a review from a team as a code owner July 27, 2026 13:49
Copilot AI review requested due to automatic review settings July 27, 2026 13:49

Copilot AI 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.

Pull request overview

Fixes the label workflow for fork PRs while preserving trusted base-repository checkout behavior.

Changes:

  • Explicitly checks out the PR base commit SHA.
  • Avoids executing fork-controlled code in pull_request_target.

@ahus1
ahus1 enabled auto-merge (squash) July 27, 2026 13:52

@rmartinc rmartinc 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.

Thanks @ahus1! LGTM!

@ahus1
ahus1 merged commit 0e2e2a9 into main Jul 27, 2026
70 checks passed
@ahus1
ahus1 deleted the copilot/fix-failing-github-actions-job-label branch July 27, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Labeler fails to set the version in the main branch

4 participants