How can I get GitHub PR id from commit hash? It is possible in git console or GitHub API?
How can I get GitHub PR id from commit hash? It is possible in git console or GitHub API?
The commit SHA for example is: 7dd1bcf5f2f5eeed34cc2ec63053098fba302b6c
is:pr is:closed 7dd1bcf5f2f5eeed34cc2ec63053098fba302b6cIf the PR is not closed then remove is:closed
https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token <TOKEN>" \
https://api.github.com/repos/OWNER/REPO/commits/COMMIT_SHA/pulls
With github-cli:
gh api /repos/OWNER/REPO/commits/COMMIT_SHA/pulls | jq -r .[].html_url