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

Not working with forks #13

Open
samuelmeuli opened this issue Jan 19, 2020 · 2 comments
Open

Not working with forks #13

samuelmeuli opened this issue Jan 19, 2020 · 2 comments
Labels

Comments

@samuelmeuli
Copy link
Owner

@samuelmeuli samuelmeuli commented Jan 19, 2020

Creating annotations and auto-fixes works as expected when the code is on a branch in the same repository.

Unfortunately, it currently doesn't seem work with pull requests from forks: The action has no permission to push auto-fix changes or create annotations.

@samuelmeuli

This comment has been minimized.

Copy link
Owner Author

@samuelmeuli samuelmeuli commented Feb 22, 2020

It seems like this is impossible with GitHub's current token scopes.

The action needs permissions for two operations:

  • Permission to create annotations with GitHub's Check Runs API to display the user's linting errors
  • Permission to push changes with Git (if auto_fix: true)

If the action is triggered on changes to the main repository, it will work because the GITHUB_TOKEN has permissions to modify that repository. On forks, however, this becomes tricky to impossible:

push event pull_request event
commit to main repo [Expected behavior] Annotations and auto-fixing work [Expected behavior] Annotations and auto-fixing work
commit to fork [Expected behavior] User needs to manually activate GitHub Actions on the fork. Even then, annotations will not display on PRs from that fork. [Unexpected behavior] No permission to push auto-fix changes to the fork. No permission to create annotations.

Note that the pull_request event always runs on the main repository, even for pushes to the fork. The token scopes are defined accordingly.

If anybody is aware of a workaround, I'd be very happy to hear it :)

Related: actions/checkout#124 (comment)

samuelmeuli added a commit that referenced this issue Feb 22, 2020
Only works partly due to GitHub's token scopes. See #13
@samuelmeuli samuelmeuli removed their assignment Feb 22, 2020
@samuelmeuli samuelmeuli changed the title Auto-fixing not working with PRs from forks Not working with forks Feb 22, 2020
@samuelmeuli samuelmeuli pinned this issue Feb 25, 2020
@samuelmeuli

This comment has been minimized.

Copy link
Owner Author

@samuelmeuli samuelmeuli commented Feb 27, 2020

All I can do for now is document these limitations in the README and provide more helpful error messages.

If you'd also like to see these permissions changed, please submit feedback to GitHub.

@samuelmeuli samuelmeuli added blocked and removed bug labels Feb 27, 2020
samuelmeuli added a commit that referenced this issue Feb 27, 2020
See #13
samuelmeuli added a commit that referenced this issue Feb 27, 2020
See #13
samuelmeuli added a commit that referenced this issue Feb 27, 2020
See #13
samuelmeuli added a commit that referenced this issue Feb 27, 2020
See #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.