"HttpError: Resource not accessible by integration" error in "PR Checklist / add-comment" GitHub action

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • WT12.0.0, 9.1.0-rc0
    • Affects Version/s: None
    • Component/s: Evergreen
    • None
    • Storage Engines - Foundations
    • 531.076
    • None
    • None

      When a PR is opened by a GitHub integration such as Dependabot, the GitHub Action that posts the "Thanks for creating a pull request!" comment with the checklist, fails with the following log:

      RequestError [HttpError]: Resource not accessible by integration
      Error: Unhandled error: HttpError: Resource not accessible by integration
          at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:9537:21
          at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {
        status: 403,
        response: {
          url: 'https://api.github.com/repos/wiredtiger/wiredtiger/issues/xxxx/comments',
          status: 403,
      

      Root cause

      In .github/workflows/pr_checklist.yml the job tries to create a PR comment using: github.rest.issues.createComment(...)

      The token available to the workflow does not have sufficient write permission for PR comments in this event context.

      Fix

      Grant explicit pull-requests: write permissions to this workflow/job.

      name: PR Checklist
      
      on:
        pull_request:
          types:
            - opened
      
      permissions:
        contents: read
        pull-requests: write
      

            Assignee:
            Salman Javed
            Reporter:
            Salman Javed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: