fix: add-to-triage does not work on PRs from fork#11
Merged
Conversation
lumirlumir
commented
Aug 7, 2025
Member
Author
|
The |
This was referenced Aug 7, 2025
2 tasks
lumirlumir
commented
Aug 7, 2025
Member
Author
|
I’ve also updated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Prerequisites checklist
What is the purpose of this pull request?
Hi,
In this PR, I've fixed the issue where the
add-to-triageworkflow wasn't working on PRs from forks.The workflow works for members who have direct access to create branches, but it doesn't work for forked repositories.
Currently, this problem arises in the Markdown repository when contributors make contributions.
https://github.com/eslint/markdown/actions/runs/16787402125/job/47558666610?pr=500
I've found the solution for this at the link below:
actions/add-to-project#422
We need to use the
pull_request_targetevent instead of thepull_requestevent to ensure it works with forked repositories.The difference between
pull_request_targetandpull_requestis:The
pull_requestevent runs in the PR's HEAD branch. So, if I'm working on thelumirlumir/markdownrepository, the workflow runs on that repository, and contributors never have access to the token information since their forked repository doesn't have the secret key.The
pull_request_targetevent runs in themainbranch of the original repository. So, even if I'm working on thelumirlumir/markdownrepository, the workflow runs in themainbranch of theeslint/markdownrepository. This way, contributors can benefit from the workflow because the secret key exists in theeslint/markdownrepository.From my research, this seems to be the common pattern for allowing workflows to run even in forked repositories.
The reason other workflows work fine, but this one caused an error, is that this workflow requires secret information that's set by the ESLint organization.
What changes did you make? (Give an overview)
I've updated the event from
pull_requesttopull_request_target.Related Issues
N/A
Is there anything you'd like reviewers to focus on?
This fix only applies to this repository, since the workflow event should be set at the repository level.
My plan is to test whether it works as expected here first, and then create a fix PR when I set up the
stale.ymlworkflow in each repository.I should have checked more carefully—sorry for causing repetitive work.