Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub token requires read/write permissions #55

Closed
MattiDragon opened this issue Apr 2, 2023 · 6 comments
Closed

GitHub token requires read/write permissions #55

MattiDragon opened this issue Apr 2, 2023 · 6 comments

Comments

@MattiDragon
Copy link

My publish workflow has failed to publish to git twice now:

I have manually published the releases, so that's why you see them.
I have no idea why it's broken, but it is

@Kir-Antipov
Copy link
Owner

Kir-Antipov commented Apr 2, 2023

Actually, no idea either. Try creating a tag, which the new release should refer to, manually for the time being

@NebelNidas
Copy link

Apparently you have to use CLASSIC_GITHUB_TOKEN now instead of GITHUB_TOKEN, as GitHub has changed the format recently

@Kir-Antipov
Copy link
Owner

CLASSIC_GITHUB_TOKEN is not a thing, really. It's a name Mineblock11 gave to their token.

Could somebody give me a link to a blog post or something that reflects the changes of the new token format, please? I've clearly missed something :D

@NebelNidas
Copy link

NebelNidas commented Apr 26, 2023

Ah, sorry. I've searched through GitHub's changelog a bit, and it seems like this change is the culprit.

Edit: See this paragraph for the exact format differences

@Kir-Antipov
Copy link
Owner

Kir-Antipov commented Apr 26, 2023

Oh, that makes a lot of sense now! Thank you. Also, I see now why I didn't notice it earlier - it's been a while since I created new repositories, and the old ones still have read/write permissions by default.

@MattiDragon, so, all you need to do is go to your repository's settings, Actions -> General -> Workflow permissions, and choose Read and write permissions there:

Permissions

Let me know if the problem persists!

@Kir-Antipov Kir-Antipov changed the title Failing to publish to github GitHub token requires read/write permissions May 20, 2023
@Kir-Antipov Kir-Antipov pinned this issue May 20, 2023
@Fallen-Breath
Copy link

Fallen-Breath commented Jun 29, 2023

Another workaround for this is to manually specify the permission grant for the GITHUB_TOKEN, e.g.

jobs:
  my_release:
    runs-on: ubuntu-latest
    permissions:
      contents: write    # <- add this
    steps:
      # ...

This allow the workflow job to modify github releases, so you don't need to configure your repository setting manually

See:

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

No branches or pull requests

4 participants