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

Failed running on github actions #166

Closed
talyaw opened this issue Aug 2, 2023 · 2 comments
Closed

Failed running on github actions #166

talyaw opened this issue Aug 2, 2023 · 2 comments

Comments

@talyaw
Copy link

talyaw commented Aug 2, 2023

I created a dummy repo and opened a PR just for testing this, but this is what I get:

Traceback (most recent call last):
  File "/app/pr_agent/servers/github_action_runner.py", line 68, in <module>
    asyncio.run(run_action())
  File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/app/pr_agent/servers/github_action_runner.py", line 53, in run_action
    await PRReviewer(pr_url).run()
  File "/app/pr_agent/tools/pr_reviewer.py", line 95, in run
    self.git_provider.publish_comment("Preparing review...", is_temporary=True)
  File "/app/pr_agent/git_providers/github_provider.py", line 123, in publish_comment
    response = self.pr.create_issue_comment(pr_comment)
  File "/usr/local/lib/python3.10/site-packages/github/PullRequest.py", line 51[7](https://github.com/talyaw/test_pr_agent/actions/runs/5735109027/job/15542318749#step:3:8), in create_issue_comment
    headers, data = self._requester.requestJsonAndCheck(
  File "/usr/local/lib/python3.10/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
    return self.__check(
  File "/usr/local/lib/python3.10/site-packages/github/Requester.py", line 4[8](https://github.com/talyaw/test_pr_agent/actions/runs/5735109027/job/15542318749#step:3:9)7, in __check
    raise self.__createException(status, responseHeaders, data)
github.GithubException.GithubException: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment"}

Any idea how to make it work?

@coditamar
Copy link
Contributor

coditamar commented Aug 2, 2023

Try adding to pr_agent.yml workflow file:

permissions:
  issues: write
  pull-requests: write

This error you got could happen if your general workflow permissions are not set to Read and write permissions

related doc:
https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token

@talyaw
Copy link
Author

talyaw commented Aug 2, 2023

Thank you, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants