Skip to content

Instantly share code, notes, and snippets.

@halaxa
Created September 30, 2021 17:15
Show Gist options
  • Save halaxa/e8153b36915b1c558dc750ab9d04c0f0 to your computer and use it in GitHub Desktop.
Save halaxa/e8153b36915b1c558dc750ab9d04c0f0 to your computer and use it in GitHub Desktop.
Convert github issue to pull request via an API call
TOKEN= # Create github token here https://github.com/settings/tokens and check `repo` scope
USERNAME= # github user name
ISSUE_ID= # issue id without '#'
PR_HEAD= # usually your feature branch
PR_BASE= # usually `master`
REPO= # repository name
curl --user "$USERNAME:$TOKEN" \
--header "Accept: application/vnd.github.v3+json" \
--request POST \
--data "{\"issue\": $ISSUE_ID, \"head\": \"$PR_HEAD\", \"base\": \"$PR_BASE\"}" \
"https://api.github.com/repos/$USERNAME/$REPO/pulls"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment