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

Add instructions for fine-grained PAT permissions #231

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:

By default, this will use the [automatic GitHub token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) that's provided to the workflow. This means the approval will come from the "github-actions" bot user. Make sure you enable the `pull-requests: write` permission in your workflow.

To approve the pull request as a different user, pass a GitHub Personal Access Token into the `github-token` input. In order to approve the pull request, the token needs the `repo` scope enabled.
To approve the pull request as a different user, pass a GitHub Personal Access Token into the `github-token` input. Newer Fine-grained tokens and older "classic" tokens require different permissions (see below).

```yaml
name: Auto approve
Expand All @@ -104,6 +104,18 @@ jobs:
github-token: ${{ secrets.SOME_USERS_PAT }}
```

#### Fine-grained Personal Access Token Permissions

Enable the following Repository permissions:

* `Metadata` : `read-only`
* `Pull requests`: `read/write`

#### "Classic" Personal Access Token Permissions

Enable the `repo` Scope.


### Approving Dependabot pull requests

When a workflow is run in response to a Dependabot pull request using the `pull_request` event, the workflow won't have access to secrets. If you're trying to use a Personal Access Token (as above) but getting an error on Dependabot pull requests, this is probably why.
Expand Down