Skip to content

Commit

Permalink
Add instructions for fine-grained PAT permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenharman committed Dec 4, 2024
1 parent 8f92909 commit 506c5ed
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit 506c5ed

Please sign in to comment.