bemanproject / exemplar

Example Beman project
Other
11 stars 16 forks source link

Proper permission fix for reviewdog #69

Closed wusatosi closed 2 weeks ago

wusatosi commented 2 weeks ago

This pr fixes the permission issue pre-commit GitHub Action was experiencing.

Turns out GitHub issues conservative permission to pull requests coming from a private fork, see: link.

To get write permission, we need to use pull_request_target as event trigger instead. In pull_request_target GitHub Actions checks out the base branch instead of the pr, so we need to manually checkout the pull request via GitHub CLI.

See: https://github.com/bean-men/testing-exempler/pull/6 as an example of correct output. Note that the pr come from my private fork from wusatosi/testing-exempler to an org in bean-man/testing-exempler.

Due to the introduced complexity, this pr also splits the pre-commit check for push and pull-request into two different jobs.

Closes #49 . (again).