Julian
Julian

Reputation: 1542

What permissions is my github PAT missing?

I'm triggering a github action using a webhook. Until recently this worked perfectly but I got a request from Github to refresh my PAT to the new format and now I get a permission denied error. Am I missing a permission or has the authorization syntax changed?

This is the webhook I'm calling:

curl -d '{"ref":"v2.0","inputs":{"oga_no":"1369"}}' -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: Basic ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' -H 'Content-Type: application/json;charset=utf-8' -X POST 'https://api.github.com/repos/ogauk/boatregister/actions/workflows/publish.yml/dispatches'

And this is the response:

{
  "message": "Must have admin rights to Repository.",
  "documentation_url": "https://docs.github.com/rest/reference/actions#create-a-workflow-dispatch-event"
}

Upvotes: 1

Views: 899

Answers (1)

Julian
Julian

Reputation: 1542

Something must have changed with the new token format. I spotted a post with a slightly different syntax and tried it.

curl -d '{"ref":"v2.0","inputs":{"oga_no":"1369"}}' -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' -H 'Content-Type: application/json;charset=utf-8' -X POST 'https://api.github.com/repos/ogauk/boatregister/actions/workflows/publish.yml/dispatches'

So changing Basic to token fixed my problem.

Upvotes: 1

Related Questions