Skip to content

Instantly share code, notes, and snippets.

@vanessaaleung
Created May 2, 2021 23:10
Show Gist options
  • Save vanessaaleung/73fdaec8a1d02c13a353c149f5b96ddc to your computer and use it in GitHub Desktop.
Save vanessaaleung/73fdaec8a1d02c13a353c149f5b96ddc to your computer and use it in GitHub Desktop.
Request GitHub PR Review
def request_pr_reviwer(owner: str, repo: str, token: str, pull_number: str, reviewers: list) -> None:
url = "https://api.github.com/repos/{}/{}/pulls/{}/requested_reviewers".format(owner, repo, pull_number)
headers = {
"Authorization": "token {}".format(token),
"Content-Type": "application/json"
}
payload = {
"reviewers" : reviewers
}
try:
requests.post(url, headers=headers, json=payload)
logging.info("Requested review from: {}".format(reviewers))
except Exception as e:
logging.error(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment