diff --git a/set-pr-milestone.py b/set-pr-milestone.py index 4a1e43c..3d276c7 100644 --- a/set-pr-milestone.py +++ b/set-pr-milestone.py @@ -16,8 +16,9 @@ patch_url = f"https://api.github.com/repos/{owner}/{repo}/issues/{args.pr}" headers = { - "Accept": "application/vnd.github.v3+json", - "Authorization": f"token {os.environ['GH_TOKEN']}", + "Accept": "application/vnd.github+json", + "Authorization": f"Bearer {os.environ['GH_TOKEN']}", + "X-GitHub-Api-Version": "2022-11-28" } response = requests.get(query_url).json() @@ -43,4 +44,8 @@ # Check for errors response.raise_for_status() +if response.json()['milestone'] is None: + print("ERROR: could not set milestone") + sys.exit(1) + print(f"Milestone set on {args.owner_repo} #{args.pr}")