curl pull request error - fork_collab Fork collab can't be granted by someone without permission

Viewed 315

I'm trying to automate github pull requests via bash script, specifically raising pull requests for forked branches. I've successfully done it for private repos, however it doesn't seem to work for public repos (see code below):

curl -H "Authorization: bearer <accesstoken>" -d '{"title":"SOMETITLE","base":"master","head":"'"someuser"':'"someForkedBranch"'","body":"some words to fill body."}' https://api.github.com/repos/<user-name>/<repo-name>/pulls

Any help would be appreciated.

1 Answers

If this is for creating a PR, you would need a -X POST somewhere in your curl command, in order to POST the query for a new PR:

curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/octocat/hello-world/pulls \
  -d '{"head":"head","base":"base"}'

Make sure also to use the right oauth/PAT or SAML SSO:

curl -v -H "Authorization: token TOKEN" -X POST ...

Those token have just seen a new format update (Apr. 2021) so you might need to regenerate one.

Related