rtCamp / action-phpcs-code-review

Github Action to perform automated code review on pull requests
https://github.com/rtCamp/github-actions-library
MIT License
103 stars 27 forks source link

Error: GitHub API communication error. Please contact a human. #43

Closed kishanjasani closed 3 years ago

kishanjasani commented 3 years ago

Firstly, I have created a token on my public repository with public-repo role on the personal token.

Secondly, When I create pull request without phpcs errors then It passes all checks. but If there are any errors then it gives me GitHub API communication error. I have also checked that GitHub API status which is also green.

Here is the link where I am facing the issue: https://github.com/kishanjasani/aquila_portfolio/pull/3

mrrobot47 commented 3 years ago

It is necessary that you create this token from a bot user account. Please note that the bot account should have access to the repo in which action is being run, in case it is a private repo. It is compulsory to use a bot account because in GitHub it is forbidden to request changes on your own Pull Request by your own user

https://github.com/rtCamp/action-phpcs-code-review#github-token-creation

@kishanjasani it seems you created token from your own account. As you can not leave review comments on your own PR, this issue has come. Please generate token using a bot account.

kishanjasani commented 3 years ago

Thanks @mrrobot47 :+1: . I have created token from my own account.

kishanjasani commented 3 years ago

@mrrobot47 Can you help me that how do I create that bot account?

mrrobot47 commented 3 years ago

A "bot account" is just another Github user account. You create it exactly as you would any other Github user account.

https://github.com/rtCamp/action-phpcs-code-review#github-token-creation https://stackoverflow.com/a/29177936

Simply create another GitHub account, give it access to your repository, and in secrets add a token from the newly created account.