RoamJS / roamjs-components

MIT License
15 stars 5 forks source link

Fine-grained tokens do not work with GitHub Rest Pull API #31

Closed mdroidian closed 3 months ago

mdroidian commented 3 months ago

tl:dr - fine-grained tokens result in 403, using classic token instead


When creating a PR via

https://github.com/RoamJS/roamjs-components/blob/a03b1b802d67a9d24d4822aa3d5a504fab7e0a1e/src/scripts/publishToRoamDepot.ts#L146-L157

Where owner = RoamJS branch = query-builder

We have been continually getting the following error (latest run with error)

{
  message: 'Resource not accessible by personal access token',
  documentation_url: 'https://docs.github.com/rest/pulls/pulls#create-a-pull-request',
  status: '403'
}

According to the GitHub REST API docs, fine-grained tokens only require "Pull request" write access for this

This endpoint works with the following fine-grained token types:

The fine-grained token must have the following permission set:

  • "Pull requests" repository permissions (write)

Yet, even with a Fine-grained token with full read-write to repo/org and access to all repos, we could continually get a 403 error.

![image](https://github.com/user-attachments/assets/9b1aca16-ab7b-4a28-9391-0af8ad7b9bc8) Note: this was also tried with multiple users as the `Resource owner` ![image](https://github.com/user-attachments/assets/3e3b51f2-78ef-48d7-899b-abdcbd38110d) ![image](https://github.com/user-attachments/assets/6baf0f38-9ac8-4c5d-804b-847216c6d4e5)

I have also replicated this using a VSCode Extension, Thunder Client, with updated headers as per GitHub docs

image

Others have also reported this issue: https://github.com/orgs/community/discussions/106661 https://github.com/orgs/community/discussions/123362

mdroidian commented 3 months ago

It appears that this requires intervention from GitHub.

Until this is fixed by GitHub, using a classic token does not result in a 403

dvargas92495 commented 3 months ago

left a comment: https://github.com/orgs/community/discussions/106661#discussioncomment-10114091