Access denied trying to update a workflow via API

I created a public repository within my personal account, created a PAT w/ the workflow permissions checked, but am unable to disable the workflow via the API as I receive a message stating that I must have admin rights to the repository. I believe the PAT has the correct permissions so I’m unsure as to why this isn’t working.

Here is the command I am attempting to use (based on the documentation):

curl -s christronyxyocum:MY-PAT -X PUT -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/MY-USERNAME/MY-REPO/actions/workflows/workflow.yml/disable

I can retrieve information about the workflow without any issues so I believe that I have the correct URL and formatting, etc.

2 Likes

I have figured this out. Rather than using the username:token format like they show repeatedly in their documentation, you must use the -H "Authorization: bearer TOKEN" header with the curl command.

1 Like

For posterity, here’s a friendly link to those docs for sending an OAuth 2 token in the header. :v: