action-gh-release: GitHub release failed with status: 404, retrying...

Got the error: GitHub release failed with status: 404, retrying...

https://github.com/rhalaly/scope-to-this-vscode/runs/2869520835?check_suite_focus=true

Running in an infinite loop. Any idea what is the reason? And how to prevent an infinite loop in the release pipeline?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (5 by maintainers)

Most upvoted comments

But why the createRelease returns 404

A 404 can happen for different reasons. In a future release Im going to include more debugging information from api response headers the logs. The the mean time the next release will include a change that limits the number of api retries are made

For those facing this issue: the “create release” API returns 404 if the discussion category name is invalid.

image

If you are using the flag to create a discussion for the release and are getting this error, make sure:

  • The discussion feature is enabled inside the repository’s settings
  • The related discussion category exists

Just for the record: I was having the exact same issue with a custom token without referencing another issue. The custom token was used to have a specific user listed as the creator of the release. The workflow step looks like this:

      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          files: 'builds/*'
          draft: true
          token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}

In my case, the issue was caused that the personal access token used in the secret was in fact a PAT of the correct user, but did not have the right scopes assigned.

@aleks-ivanov Thank you!

Depends on what you need specifically of course, but it should look something like this:

run: |
  gh release create ${{ env.VERSION }} -n "${{ env.MESSAGE }}" -t "${{ env.NAME }}" ${{ env.FILES }}
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  VERSION: "tag for release"
  MESSAGE: "message for release"
  NAME: "release name"
  FILES: path/to/file1 path/to/file2 ...

The sample code is from this thread

When I make it specifically for the pipeline I am working on, I will share a link to it.