marvinpinto/actions

action-automatic-releases broken - UnhandledPromiseRejectionWarning: HttpError: Resource not accessible by integration

Closed this issue ยท 5 comments

This was working as expected until a few weeks ago, now when trying to use the action the following error occurs:

Generating changelog
  Error: Resource not accessible by integration
  (node:1865) UnhandledPromiseRejectionWarning: HttpError: Resource not accessible by integration
      at /home/runner/work/_actions/marvinpinto/action-automatic-releases/latest/dist/index.js:1:361954
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
  (node:1865) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
  (node:1865) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Perhaps JS is trying to read from a variable or file that doesn't exist?


This is being called in my workflow as follows:

  - name: Download Example Artifact
    uses: actions/download-artifact@v2
    with:
      name: "hello-world"

  - name: Create Github Release With Example Artifact
    uses: marvinpinto/action-automatic-releases@latest
    with:
      repo_token: "${{ secrets.GITHUB_TOKEN }}"
      prerelease: true
      automatic_release_tag: "${{ steps.calver.outputs.release }}-${{ github.run_id }}"
      files: |
        "hello-world.zip"

Did you per chance enable permissions on your repo? I recently ran into something similar, this is what I use on another repo:

permissions:
  id-token: "write"
  contents: "write"
  packages: "write"
  pull-requests: "read"

You can probably ignore id-token unless you're using GitHub OIDC auth. The permissions are not very well documented so I had to figure this out by trial and error.

Ah interesting, it must have changed at the org level! Thank you for this, sorry to waste your time.

For anyone else coming along later, I had to go to Settings -> Actions -> General and give "Read and write permissions" to the Github Actions workflows.

I also just ran into the "Resource not accessible by integration" error for the first time after using this action for well over a year. I was quite confused, because I thought I understand it well. The requirement to have pull-requests permissions, was unexpected, even though it makes perfect sense now.

For anyone else coming along later, I had to go to Settings -> Actions -> General and give "Read and write permissions" to the Github Actions workflows.

It is not recommended to solve the problem on the repo level. I had to just specify the workflow's permissions as per this comment, which is more secure I believe.