Skip to content

Workflows: Use pull_request_target for cherry-pick workflow#75775

Merged
ellatrix merged 2 commits intotrunkfrom
fix/cherry-pick-workflow-fork-prs
Feb 20, 2026
Merged

Workflows: Use pull_request_target for cherry-pick workflow#75775
ellatrix merged 2 commits intotrunkfrom
fix/cherry-pick-workflow-fork-prs

Conversation

@ellatrix
Copy link
Member

@ellatrix ellatrix commented Feb 20, 2026

Summary

  • The cherry-pick workflow fails on fork PRs when triggered by the labeled event because pull_request events from forks don't have access to repository secrets (GUTENBERG_TOKEN), causing the checkout step to fail with Input required and not supplied: token.
  • Switches the trigger from pull_request to pull_request_target so the workflow runs in the context of the base repository with access to secrets.
  • This is safe because the workflow only operates on already-merged commits (guarded by github.event.pull_request.merged == true).

Fixes: https://github.com/WordPress/gutenberg/actions/runs/22221270711/job/64277381091

Test plan

  • Merge this PR
  • Add a Backport to WP 7.0 Beta/RC label to a merged fork PR
  • Verify the cherry-pick workflow runs successfully

🤖 Generated with Claude Code

The cherry-pick workflow fails on fork PRs when triggered by the
`labeled` event because `pull_request` events from forks don't
have access to repository secrets. This causes the checkout step
to fail with "Input required and not supplied: token" since
`secrets.GUTENBERG_TOKEN` is empty.

Switch to `pull_request_target` so the workflow runs in the context
of the base repository with access to secrets. This is safe because
the workflow only operates on already-merged commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ellatrix ellatrix requested a review from desrosj as a code owner February 20, 2026 11:16
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ellatrix <ellatrix@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ellatrix ellatrix added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Feb 20, 2026
@ellatrix
Copy link
Member Author

Let's try this for #75746.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ellatrix
Copy link
Member Author

Let's try it

@ellatrix ellatrix merged commit e294a10 into trunk Feb 20, 2026
39 checks passed
@ellatrix ellatrix deleted the fix/cherry-pick-workflow-fork-prs branch February 20, 2026 11:55
@github-actions github-actions bot added this to the Gutenberg 22.7 milestone Feb 20, 2026
@ellatrix
Copy link
Member Author

ellatrix commented Feb 20, 2026

I think the reason it still doesn't work is that that PR is not based on this. Hopefully this fixes the issue for future forks.

scruffian pushed a commit that referenced this pull request Feb 23, 2026
* Workflows: Use pull_request_target for cherry-pick workflow

The cherry-pick workflow fails on fork PRs when triggered by the
`labeled` event because `pull_request` events from forks don't
have access to repository secrets. This causes the checkout step
to fail with "Input required and not supplied: token" since
`secrets.GUTENBERG_TOKEN` is empty.

Switch to `pull_request_target` so the workflow runs in the context
of the base repository with access to secrets. This is safe because
the workflow only operates on already-merged commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add link to pull_request_target docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant