Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/release/generate_history_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

import fileinput
import json
import os
import re
import subprocess
import requests
from requests.auth import HTTPBasicAuth

base_url = 'https://api.github.com/repos/azure/azure-cli'
commit_pr_url = '{}/commits/commit_id/pulls'.format(base_url)
Expand All @@ -27,6 +29,7 @@

def generate_history_notes():
dev_commits = get_commits()
print("Get PRs for {} commits.".format(len(dev_commits)))
for commit in dev_commits:
prs = get_prs_for_commit(commit['sha'])
# parse PR if one commit is mapped to one PR
Expand Down Expand Up @@ -118,7 +121,7 @@ def get_commits():
def get_prs_for_commit(commit: str):
headers = {'Accept': 'application/vnd.github.groot-preview+json'}
url = commit_pr_url.replace('commit_id', commit)
response = requests.get(url, headers=headers)
response = requests.get(url, headers=headers, auth=HTTPBasicAuth('anything', os.environ.get('PAT_TOKEN')))
if response.status_code != 200:
raise Exception("Request to {} failed with {}".format(
url, response.status_code))
Expand Down