Skip to content
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

Action doesn't work for forks (Resource not accessible by integration) #25

Open
TimonVS opened this issue Oct 26, 2019 · 1 comment
Open
Labels
bug Something isn't working

Comments

@TimonVS
Copy link
Owner

TimonVS commented Oct 26, 2019

The Action fails to run on PRs that are submitted from a fork. As an example see the failing check on #24. It's basically the same issue as actions/labeler#12.

@JohnRDOrazio
Copy link

JohnRDOrazio commented Aug 2, 2021

I was able to implement for PR's coming from forks by using the pull_request_target action instead of the pull_request action:

name: PR Labeler
on:
  pull_request_target:
    types: [opened]

nowsprinting added a commit to nowsprinting/Anjin that referenced this issue Apr 8, 2023
When PR from public fork, Do not access configuration file in
pull_request trigger.

pull_request_target trigger is:

- GITHUB_TOKEN is granted read/write repository permission unless the permissions key is specified and the workflow can access secrets, even when it is triggered from a fork
- Runs in the context of the base of the pull request (NOT merge commit)

refs:

- TimonVS/pr-labeler-action#25 (comment)
- https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
aloisklink added a commit to mermaid-js/mermaid that referenced this issue Sep 24, 2023
Replace the `TimonVS/pr-labeler-action` with
`release-drafter/release-drafter` as it has an [`autolabeler`][1]
option that can autolabel PRs for us.

This should fix labeling PRs from forks,
see TimonVS/pr-labeler-action#25.

I've kept the `.github/pr-labeler.yml` configuration file, so that
links to it from the https://mermaid.js.org website continue to work.

I've also kept everything in the same
`.github/workflows/pr-labeler.yml` GitHub Actions workflow to make the
`git diff` easier to review, and to keep the GitHub Actions permissions
the same.

[1]: https://github.com/release-drafter/release-drafter/blob/ff929b5ceb21bf2646a216e916f9a8bb507d48a3/README.md#autolabeler
aloisklink added a commit to mermaid-js/mermaid that referenced this issue Sep 24, 2023
Replace the `TimonVS/pr-labeler-action` with
`release-drafter/release-drafter` as it has an [`autolabeler`][1]
option that can autolabel PRs for us.

This should fix labeling PRs from forks,
see TimonVS/pr-labeler-action#25.

I've kept the `.github/pr-labeler.yml` configuration file, so that
links to it from the https://mermaid.js.org website continue to work.

I've also kept everything in the same
`.github/workflows/pr-labeler.yml` GitHub Actions workflow to make the
`git diff` easier to review, and to keep the GitHub Actions permissions
the same.

[1]: https://github.com/release-drafter/release-drafter/blob/ff929b5ceb21bf2646a216e916f9a8bb507d48a3/README.md#autolabeler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants