softprops / action-gh-release

📦 :octocat: GitHub Action for creating GitHub Releases
MIT License
3.91k stars 440 forks source link

GitHub error 403 undefined #400

Open CryZe opened 7 months ago

CryZe commented 7 months ago

I'm getting the following error:

👩‍🏭 Creating new GitHub release for tag latest...
⚠️ GitHub release failed with status: 403
undefined
retrying... (2 retries remaining)
👩‍🏭 Creating new GitHub release for tag latest...
⚠️ GitHub release failed with status: 403
undefined
retrying... (1 retries remaining)
👩‍🏭 Creating new GitHub release for tag latest...
⚠️ GitHub release failed with status: 403
undefined
retrying... (0 retries remaining)
❌ Too many retries. Aborting...
Error: Too many retries.

https://github.com/CryZe/game-maker-auto-splitter/actions/runs/7301685228/job/19899026066#step:5:10

This is how I invoke the action:

      - name: Release
        if: github.ref == 'refs/heads/master'
        uses: softprops/action-gh-release@v1
        with:
          files: target/wasm32-unknown-unknown/release/game_maker_auto_splitter.wasm
          name: Latest
          tag_name: latest
          body: This contains the latest version of the auto splitter.
estebanfern commented 7 months ago

Same error :(

StefH commented 7 months ago

Same here: image

christianll9 commented 7 months ago

Here is one solution. Or look into one of the other open 403 Error issues in this repo.

estebanfern commented 7 months ago

Hey, i found the solution. In the repository settings, go to Actions -> General image Allow Read and Write Permissions for Github Workflows and save changes. If your repository is from an organization you will have to do an extra step, go to Organization Settings -> Actions -> General image

eggsy84 commented 6 months ago

You should also be able to specify that in the job with permissions such as

create-release:
    name: Create draft release
    runs-on: ubuntu-latest
    permissions: 
      contents: write
    steps:
      - name: Create Release
        uses: softprops/action-gh-release@v1

# rest of code here
koss110 commented 6 months ago

Both parts are required:

  1. Workflow permissions - suggested by @estebanfern https://github.com/softprops/action-gh-release/issues/400#issuecomment-1870332450

  2. Configuring the permissions at the workflow file permissions: contents: write , suggested by @eggsy84

drojf commented 5 months ago

@koss110 - I don't think you need both - it's more like you need either.

You can enable write permissions for all workflows in a repo or organization via the Settings->Actions->General GUI option.

You can enable write permissions for one workflow via the contents: write permission in the .yaml file.

In the past the default option was read/write, but it changed about a year ago. See this for more details: https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/

ForNeVeR commented 5 months ago

Can confirm that adding this to YAML is enough:

    permissions:
      contents: write

It is not necessary to manually edit the permissions in the GitHub UI.