Github trigger on pull request created fails with pat

Describe the problem/error/question

I’m trying to setup a trigger on creation of GH pull request. I’m using a Fine-grained personal access token with the “Webhooks” write permissions set, according to github’s API docs.

Still after adding the token as a credential to connect with successfully, setting the repo owner, and the repo, when I click on “Test step”:

it fails with this message:
image

Any idea what to try, do we need to add some other permission to the token?

Thanks!

Information on your n8n setup

  • n8n version: Cloud version
  • Database (default: SQLite): N/A
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
  • Operating system: Mac

Hi @payala

Thanks for posting here and welcome to the community! :cake:

While the webhook permission is enough to create the webhook connection, Github needs permission for every event that is being sent. In your case this would be fetching the PRs.

The fine-grained token must have at least one of the following permission sets:

"Pull requests" repository permissions (read)
"Contents" repository permissions (read)

As mentioned here:
https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request

Let us know if that helps! :raised_hands:

Hi,

Thanks for your reply, the token does have the pull requests permissions, and commits as well. Not sure what is wrong, is there a way to get more detailed logs, or maybe a curl that would simulate the API call n8n is doing to get the raw response from GH and see what is failing?

Thanks again for your help,
Pedro