diff --git a/tag_build.py b/tag_build.py index a90bba4..f5fff49 100644 --- a/tag_build.py +++ b/tag_build.py @@ -31,6 +31,14 @@ MAIN_REPO = PULL_REPOS[1] PUSH_REPO = 'git@github.com:citra-emu/citra-bleeding-edge' # PUSH_REPO = 'git@github.com:jroweboy/lemon' +GITHUB_API_HEADERS = { + 'User-Agent': 'citra-emu/lemonbot' +} +GITHUB_API_PARAMS = { + 'client_id': 'xxxx', + 'client_secret': 'yyyy' +} + class TagMergeBot: ''' Fetches all the pull requests on a repository and merges all the pull requests with a specified tag on them. ''' def __init__(self, main_repo, pull_repos, push_repo): @@ -67,15 +75,15 @@ class TagMergeBot: self.current_prs = {} for repo in self.repos: self.current_prs[repo['remote_name']] = [] - res = requests.get(GITHUB_API+'/{owner}/{repo}/issues?labels={labels}&per_page=100'.format(labels=LABEL_TO_FETCH, owner=repo['owner'], repo=repo['name'])) + res = requests.get(GITHUB_API+'/{owner}/{repo}/issues?labels={labels}&per_page=100'.format(labels=LABEL_TO_FETCH, owner=repo['owner'], repo=repo['name']), params=GITHUB_API_PARAMS, headers=GITHUB_API_HEADERS) if res.status_code != 200: - logger.error("Could not retrive pull requests from github") + logger.error("Could not retrive pull requests from github. Status: {status}".format(status=res.status_code)) return False issues = res.json() for issue in issues: - pr_response = requests.get(issue['pull_request']['url']) + pr_response = requests.get(issue['pull_request']['url'], params=GITHUB_API_PARAMS, headers=GITHUB_API_HEADERS) if res.status_code != 200: - logger.warn("Couldn't fetch the PRs details for PR {pr}".format(pr=issue[''])) + logger.warn("Couldn't fetch the PRs details for PR {pr}. Status: {status}".format(pr=issue[''], status=res.status_code)) continue pr = pr_response.json() self.current_prs[repo['remote_name']].append({"number": pr['number'], "commit": pr['head']['sha'], "ref": pr['head']['ref']})