-
-
Notifications
You must be signed in to change notification settings - Fork 5
fix: add-to-triage does not work on PRs from fork
#11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| - transferred | ||
|
|
||
| pull_request: | ||
| pull_request_target: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
The |
|
I’ve also updated
|
nzakas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!


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.