Skip to content

response returned 403 from POST (thread-comments for a PR) #327

Description

@quqiOnfree

What events trigger your workflow?

on:
  pull_request:
    branches: [main, master, develop]
    paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc', '**.hh', '**CMakeLists.txt', 'meson.build', '**.cmake']
  push:
    branches: [main, master, develop]
    paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc', '**.hh', '**CMakeLists.txt', 'meson.build', '**.cmake']

permissions:
  pull-requests: write

What OS does your workflow use?

runs-on: ubuntu-latest

How is cpp-linter-action configured?

- uses: cpp-linter/cpp-linter-action@v2
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          style: 'file'
          tidy-checks: ''
          extra-args: '-std=c++23'
          thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}

What was the unexpected behavior?

When I pull request, the error occurred at creating an issue comment

ERROR:CPP Linter:response returned 403 from POST https://api.github.com/repos/Hcolda/QChatServer/issues/45/comments with message: {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/issues/comments#create-an-issue-comment","status":"403"}
  Traceback (most recent call last):
    File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2/.venv/bin/cpp-linter", line 10, in <module>
      sys.exit(main())
               ^^^^^^
    File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2/.venv/lib/python3.12/site-packages/cpp_linter/__init__.py", line 81, in main
      rest_api_client.post_feedback(files=files, args=args, clang_versions=clang_versions)
    File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2/.venv/lib/python3.12/site-packages/cpp_linter/rest_api/github_api.py", line 264, in post_feedback
      self.update_comment(
    File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2/.venv/lib/python3.12/site-packages/cpp_linter/rest_api/github_api.py", line 361, in update_comment
      self.api_request(url=comments_url, method=req_meth, data=payload)
    File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2/.venv/lib/python3.12/site-packages/cpp_linter/rest_api/__init__.py", line 124, in api_request
      response.raise_for_status()
    File "/home/runner/work/_actions/cpp-linter/cpp-linter-action/v2/.venv/lib/python3.12/site-packages/requests/models.py", line 1026, in raise_for_status
      raise HTTPError(http_error_msg, response=self)
  requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/Hcolda/QChatServer/issues/45/comments

I doubted that it was my fault, so I checked my permission settings in my repository:
Image
Then I checked them in my organization:
Image
I have no idea about that, so I put an issue for help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions