Skip to content

What pemission scopes does the action need for the generated GITHUB_TOKEN? #220

Closed

Description

Hello there, hope everything is fine

I was wondering which permission scopes should I grant for the PAT (personal access token) of changesets action.
Below is the list of permission scopes available for PATs, I have some ambiguity to choose some of them.

image
image

And there's also some problem with this approach of giving PAT as github_token to the action, since the PAT gives access to all repos and you can't limit the scope.
Isn't there any better approach for that?

Activity

  1. Andarist commented on Oct 9, 2022

    @Andarist
    Member

    Quite frankly - I'm not entirely sure. Those permissions are always confusing to me. Especially since they don't correspond 1 to 1 to the permissions for the workflow jobs.

    What we need is:

    • fetch the content of the repository
    • push to the repository
    • search through PRs
    • create PRs
    • create GitHub releases

    This would be definitely useful information to have in the docs but it requires some experimentation to figure out which minimal combination of those scopes would allow the action to function properly.

    And there's also some problem with this approach of giving PAT as github_token to the action, since the PAT gives access to all repos and you can't limit the scope.

    You can create a new "bot"-like account, limit its access to a particular repo and generate PAT for that account.

  2. frangio commented on Jan 2, 2023

    @frangio

    You can find the required permissions by looking up the REST endpoints in Permissions required for fine-grained personal access tokens.

    Edit: Hm, these don't look like the ones in the screenshot. But see section below.


    And there's also some problem with this approach of giving PAT as github_token to the action, since the PAT gives access to all repos and you can't limit the scope.
    Isn't there any better approach for that?

    You should look into Fine-grained PATs. You can scope them by repository.

  3. ernestognw commented on Jan 13, 2023

    @ernestognw
    Contributor

    What we need is:

    • fetch the content of the repository
    • push to the repository
    • search through PRs
    • create PRs
    • create GitHub releases

    To summarize, the permissions required are:

    • Contents (read/write): Covers fetch content of the repository, push commits and create releases
    • Pull Request (read/write): Covers create and write PRs

    If you don't publish using Changesets, Releases is not required although it falls inside of the Contents category

  4. dstaley commented on Jan 19, 2023

    @dstaley

    For anyone thinking of using fine-grained tokens, be aware that they don't currently support the GraphQL API, which is required for @changesets/changelog-github:

    Personal access tokens with fine grained access do not support the GraphQL API
    
  5. Andarist commented on Jan 19, 2023

    @Andarist
    Member

    I'm using those in XState and it works fine (but I don't use the GraphQL API there):
    https://github.com/statelyai/xstate/blob/aad4991b4eb04faf979a0c8a027a5bcf861f34b3/.github/workflows/release.yml#L13-L16

    I'd appreciate it if somebody could prepare a PR documenting this.

  6. dstaley commented on Jan 19, 2023

    @dstaley

    @Andarist ah sorry! I'm so used to the GitHub changelogs that I forgot it's not the default configuration. I've edited my comment to be more accurate. Thanks for the clarification!

  7. kenneth-gray commented on Jan 28, 2023

    @kenneth-gray

    What we need is:

    • fetch the content of the repository
    • push to the repository
    • search through PRs
    • create PRs
    • create GitHub releases

    To summarize, the permissions required are:

    • Contents (read/write): Covers fetch content of the repository, push commits and create releases
    • Pull Request (read/write): Covers create and write PRs

    If you don't publish using Changesets, Releases is not required although it falls inside of the Contents category

    @ernestognw Is this using the fine-grained tokens? I haven't been able to get this to work with just those 2 read/write permissions.

  8. kenneth-gray commented on Jan 29, 2023

    @kenneth-gray

    I can confirm that these permissions work as expected. I struggled to get the token recognised. As seen in some other issues, adding the PAT token as part of the GitHub checkout action solved my problem.

  9. nyonson commented on Feb 23, 2023

    @nyonson

    @kenneth-gray did you get this working by not using the changeset version? I still get Personal access tokens with fine grained access do not support the GraphQL API even with the PAT using those permissions and set on both the checkout action and changeset action.

  10. added theissue type on May 15, 2026
  11. bluwy commented on Sep 4, 2026

    @bluwy
    Member

    We now document the required permissions like this:

    Image

    This applies to the job permissions that controls the given GITHUB_TOKEN or the default token the action uses even if you didn't pass it specifically.

    For PATs though, they scope permissions differently and I think the best way is to check if they cover the job permissions as we describe. For classic PATs, I think the repo scope would cover all that's needed. But it's a broad set of permissions, so you may still want to consider configuring through job permissions instead to prevent potential security issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions