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

ERROR Resource not accessible by integration #236

Open
chickenandpork opened this issue Aug 24, 2023 · 5 comments
Open

ERROR Resource not accessible by integration #236

chickenandpork opened this issue Aug 24, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@chickenandpork
Copy link

With slight changes from the example config, my PRs are seeing this failure message at subject: ERROR Resource not accessible by integration

Config

name: automerge
on:
  pull_request:
    types:
      - labeled
      - unlabeled
      - synchronize
      - opened
      - edited
      - ready_for_review
      - reopened
      - unlocked
  pull_request_review:
    types:
      - submitted
  check_suite:
    types:
      - completed
  status: {}
jobs:
  automerge:
    runs-on: ubuntu-latest
    permissions:
      # actions: read|write|none
      # Note: Advice from https://github.com/pascalgn/automerge-action/issues/214
      contents: write
    steps:
      - id: automerge
        name: automerge
        uses: "pascalgn/automerge-action@v0.15.6"
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_LABELS: "!wip"
          MERGE_METHOD_LABELS: "automerge=merge,autosquash=squash"
          MERGE_METHOD_LABEL_REQUIRED: true
          MERGE_COMMIT_MESSAGE: "pull-request-description"
          MERGE_RETRIES: "10"
          MERGE_RETRY_SLEEP: "30000"
          MERGE_REQUIRED_APPROVALS: "0"
          UPDATE_LABELS: ""
          UPDATE_METHOD: "rebase"

Detected Labels

$ gh pr view 19 --json labels
{
  "labels": [
    {
      "id": "LA_kwDOKFf69c8AAAABXivleg",
      "name": "automerge",
      "description": "",
      "color": "42EA5A"
    }
  ]
}

Failing Log

Run pascalgn/automerge-action@v0.15.6
  env:
    GITHUB_TOKEN: ***
    MERGE_LABELS: !wip
    MERGE_METHOD_LABELS: automerge=merge,autosquash=squash
    MERGE_METHOD_LABEL_REQUIRED: true
    MERGE_COMMIT_MESSAGE: pull-request-description
    MERGE_RETRIES: 10
    MERGE_RETRY_SLEEP: 30000
    MERGE_REQUIRED_APPROVALS: 0
    UPDATE_LABELS: 
    UPDATE_METHOD: rebase
2023-08-24T18:51:13.219Z INFO  Event name: pull_request
2023-08-24T18:51:13.477Z ERROR Resource not accessible by integration

It would be awesome if the inaccessible Resource was named or identified I think; can you suggest what else I can try?

@RoelAdriaans
Copy link

The reason for this is issue #214 , the automation does not have enough rights to your repository.
This can be fixed with:

...
    steps:
      - id: automerge
        name: automerge
        uses: "pascalgn/automerge-action@v0.15.6"
        permissions:
          contents: write
...

@pascalgn
Copy link
Owner

I've updated the README and closed #214, so I think this one can also be closed.

@chickenandpork
Copy link
Author

Thanks @pascalgn ; I hope it fixes it. I forget now where I was trying this.

Did you see where I asked:

It would be awesome if the inaccessible Resource was named

Is that just assumed to be the repository, or if the error's on write, maybe it was worth logging what was refused? It's kinda frustrating to see "something was refused" with no real way to find out what :(

@chickenandpork
Copy link
Author

Oh, wait, my failure already had permissions: check my copy of config above:

      ...
      # Note: Advice from https://github.com/pascalgn/automerge-action/issues/214
      contents: write
      ...

So this workaround from #214 was already in place? Or was it incorrectly in place ? Otherwise, the thing that's there in the problem example can't fix the problem.

@pascalgn
Copy link
Owner

I think it's not clear from the logging, but the error message comes directly from GitHub. If you search for "Resource not accessible by integration" you find lots of other people who are having various problems when calling the GitHub API. I agree that the error message is not helpful.

@pascalgn pascalgn reopened this Apr 11, 2024
@pascalgn pascalgn added the bug Something isn't working label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants