Created
May 2, 2021 23:11
-
-
Save vanessaaleung/9924b096544189fcaea19ee3cdbf04a2 to your computer and use it in GitHub Desktop.
Add Label to GitHub PR
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 add_pr_label(owner: str, repo: str, token: str, pull_number: str) -> None: | |
url = "https://api.github.com/repos/{}/{}/issues/{}/labels".format(owner, repo, pull_number) | |
headers = { | |
"Authorization": "token {}".format(token), | |
"Content-Type": "application/json" | |
} | |
payload = { | |
"labels" : ["driver"] | |
} | |
try: | |
requests.post(url, headers=headers, json=payload) | |
logging.info("Added label driver to PR") | |
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