Skip to content

feat: report token permissions via env var - #4662

Open
jenseng wants to merge 1 commit into
actions:mainfrom
jenseng:feat-token-permissions
Open

feat: report token permissions via env var#4662
jenseng wants to merge 1 commit into
actions:mainfrom
jenseng:feat-token-permissions

Conversation

@jenseng

@jenseng jenseng commented Aug 28, 2026

Copy link
Copy Markdown

What

Set a GITHUB_TOKEN_PERMISSIONS environment variable that reports the default github token's permissions, e.g.

{"contents": "write", "pull_requests": "read", ...}

Why

Background: https://github.com/orgs/community/discussions/73397

For authors of reusable actions, there's not a good way to know which permissions are available to the github token. Although the permissions do appear in the output (under Set up job), you can't get at them programmatically unless you do silly things like parse the Worker_*.log file to extract it from the job message 🙈

By making those permissions readable from the environment, actions can do things like:

  • inform the end-user that some required permissions need to be set on the job in order for the action to work
  • fall back to other strategies of accessing data, depending on which permission are available (for example)
  • etc

@jenseng
jenseng requested a review from a team as a code owner August 28, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant