Skip to content

403 Forbidden "Resource not accessible by integration" when posting PR comment action #12

@RektPunk

Description

@RektPunk

The GitHub Action fails with a 403 Forbidden error when attempting to post a compatibility report as a comment on a Pull Request. I think the error message indicates that the action does not have sufficient permissions to access the resource.

Affected workflow snippet:

- name: Comment on PR
  if: github.event_name == 'pull_request'
  uses: actions/github-script@v6
  with:
    script: |
      const fs = require('fs');
      const report = fs.readFileSync('compatibility-report.md', 'utf8');

      github.rest.issues.createComment({
        issue_number: context.issue.number,
        owner: context.repo.owner,
        repo: context.repo.repo,
        body: report
      });
RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:6842:21
    ...
    status: 403,
    response: {
      data: {
        message: 'Resource not accessible by integration',
        documentation_url: 'https://docs.github.com/rest/issues/comments#create-an-issue-comment',
        status: '403'
      }
    }

Action link:
https://github.com/xRiskLab/xBooster/actions/runs/20390887263/job/58599901359
https://github.com/xRiskLab/xBooster/actions/runs/20390511427/job/58598999304
https://github.com/xRiskLab/xBooster/actions/runs/20391375392/job/58601013960
https://github.com/xRiskLab/xBooster/actions/runs/20410550898/job/58646709508

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions