Created
May 2, 2021 23:10
-
-
Save vanessaaleung/73fdaec8a1d02c13a353c149f5b96ddc to your computer and use it in GitHub Desktop.
Request GitHub PR Review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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