Problem

Recently, whilst trying to run the following command in a GitHub Actions workflow script to create a new Release in my GitHub Repository:

gh release create XXXX --generate-notes

However, strangely I encountered the following workflow error:

HTTP 403: Resource not accessible by integration

If you’ve faced the same error, then you’re in luck – because I’ll be sharing the solution that worked for me to resolve this issue.

Solution

Well after some head-scratching … I eventually discovered that the root cause of the problem related to a permissions issue within the GitHub Actions workflow. The workflow failed to run because it required elevated privileges to execute the “gh release create” command.

The solution was to modify my GitHub Actions workflow to request additional permissions as per https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions.

Quick tip: One quick method to verify if this solution will work for you, is to request ‘permissions: write-all’ in your workflow script (rather than granularly requesting the required permissions). Assuming this works for you and confirms that a permissions issue is indeed the root cause, then I suggest adjusting the scope to granularly request the permissions you need as per GitHub’s documentation.

For example:

jobs:   
   publish-release:
    needs: build
    runs-on: ubuntu-latest
    permissions: write-all
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

Final Thoughts

Well, I hope this solution has worked for you to resolve the ‘HTTP 403: Resource not accessible by integration’ error with GitHub Actions.

If you find any alternative solutions, then please post them in the comments below to help others out there.

Happy coding! 🙂

Shane Bartholomeusz