dessant / lock-threads

GitHub Action that locks closed issues, pull requests and discussions after a period of inactivity
https://github.com/marketplace/actions/lock-threads
MIT License
313 stars 34 forks source link

Resource not accessible by integration #47

Closed cevich closed 6 months ago

cevich commented 6 months ago

Periodically (and I have no idea why yet) I'm getting this error message:

Run dessant/lock-threads@v5
  with:
    issue-inactive-days: 90
    pr-inactive-days: 90
    add-issue-labels: locked - please file new issue/PR
    add-pr-labels: locked - please file new issue/PR
    pr-lock-reason: resolved
    log-output: true
    github-token: ***
    issue-lock-reason: resolved
    discussion-inactive-days: 365
  env:
    CLOSED_DAYS: 90
    LOCKED_LABEL: locked - please file new issue/PR
Error: Request failed due to following response errors:
 - Resource not accessible by integration

Example workflow: https://github.com/containers/podman/actions/runs/8413040871/job/23034670057

This is happening on several repos where this (same) workflow is re-used. Again, some times it runs fine, no problem. Other times it gives this error. No repository settings are changing between success/failure. Any idea what might be going on or where to look further?

twpayne commented 6 months ago

I've also just recently started seeing this, for example on this run. Presumably this is due to a change or bug at GitHub?

cevich commented 6 months ago

oh good, I'm happy to hear it's not just me.

Presumably this is due to a change or bug at GitHub?

Yes, that would be my guess as well. However I don't work with the APIs that much, so really don't know what sort of bug to report (and if they'll even care). It doesn't help that the problem seems to be intermittent.

In any case, any help debugging this, or insight into how it can be debugged would be greatly appreciated. I'm really simply out of my depth here.

kevinpapst commented 6 months ago

Never had the issue before, but on the first run after switching from dessant/lock-threads@v4 to dessant/lock-threads@v5 I experienced this issue multiple times.

Tried changing the access token, but didn't help.

Reverted back to @v4 and stopped failing immediately.

dessant commented 6 months ago

The error could be caused by a missing permission, v5 also processes discussions by default. Please try declaring the new permission in your workflow file, or disable the processing of discussions.

Add the new permission to process discussions:

permissions:
  issues: write
  pull-requests: write
  discussions: write

Alternatively you could disable the processing of discussions, in that case the new permission will not be needed:

    steps:
      - uses: dessant/lock-threads@v5
        with:
          process-only: 'issues, prs'
kevinpapst commented 6 months ago

@dessant thanks, that was an important hint. fixed my failing runs 👍

Sorry for not reading better, I missed the BC in the Changelog: https://github.com/dessant/lock-threads/blob/main/CHANGELOG.md#-breaking-changes

twpayne commented 6 months ago

Thank you, this was also the problem for me. Apologies for missing this in the release notes.

I would have found it easier to debug if the "Resource not accessible by integration" error message included which resource was not accessible? Maybe a bit of extra logging in the case of an error here would help?

Thank you again for your work and the fast response!

cevich commented 6 months ago

Thanks guys, I'll give the permissions addition a try. I also agree, it would be really helpful to know what the "resource" referred to in the error.