Skip to content

Why can't my action create a release using GITHUB_TOKEN even with "contents: write" permission enabled? #121022

Answered by rstarkov
rstarkov asked this question in Actions
Discussion options

You must be logged in to vote

Careful testing of PAT fine-grained permissions has cleared this up somewhat.

A PAT limited to contents:write can ONLY tag the head commit. Other hashes fail. A PAT with contents:write + workflows:write can tag anything. Documentation for POST to https://api.github.com/repos/OWNER/REPO/git/refs mentions these two sets of permissions without explaining what the difference is.

Assuming that this distinction is intentional, it's now clear why it fails with GITHUB_TOKEN: those can't have the workflows permission. So at this stage I believe it's impossible for GITHUB_TOKEN to tag anything except the head commit, and that this is probably intentional, but not clearly documented.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@grandmas-favorite
Comment options

Answer selected by rstarkov
Comment options

You must be logged in to vote
0 replies

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
4 participants