Skip to content

Explain how an action can dynamically determine its GITHUB_TOKEN permissions #19323

Closed

Description

@jsoref

Code of Conduct

What article on docs.github.com is affected?

https://github.com/proxy/docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

What part(s) of the article would you like to see updated?

There's a section about
Using the GITHUB_TOKEN in a workflow

And similarly
Permissions for the GITHUB_TOKEN

There should be a section that explains how something running with a token can determine what permissions it has from the token.

Additional information

None of this content explains how an action can find out what permissions it actually has. I have an action (and many others do as well) which would like to be able to perform certain tasks (a simple example is actions/labeler). Some organizations disable write permissions to workflows, which means that an action (especially labeler) will fail when run in them. The workflow that uses labeler is likely to be written for its original repository (where it has write permissions), but when the repository is forked to the more restrictive organization, the workflow will malfunction.

If there were an easy way for an action (or workflow) to ask "what permissions do I have", it could either stop early, or at provide helpful error handling instead of just encountering a 404 and dying ungracefully.

Activity

  1. added
    contentThis issue or pull request belongs to the Docs Content team
    on Jul 26, 2022
  2. added
    triageDo not begin working on this issue until triaged by the team
    on Jul 26, 2022
  3. cmwilson21 commented on Jul 27, 2022

    @cmwilson21
    Contributor

    @jsoref Thanks so much for opening an issue! I'll triage this for the team to take a look 👀

  4. added
    actionsThis issue or pull request should be reviewed by the docs actions team
    waiting for reviewIssue/PR is waiting for a writer's review
    and removed
    triageDo not begin working on this issue until triaged by the team
    on Jul 27, 2022
  5. janiceilene commented on Aug 16, 2022

    @janiceilene
    Contributor

    Hey @jsoref I've talked with the team and this is something that would be better to send over to the actions product folks! You can post in the new https://github.com/orgs/community/discussions/categories/actions-and-packages and come back to let us know if there ends up being something to change in the docs ✨

  6. jsoref commented on Jul 24, 2023

    @jsoref
    ContributorAuthor
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

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content teamwaiting for reviewIssue/PR is waiting for a writer's review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions