diff --git a/.ci/magic-modules/downstream_changelog_metadata.py b/.ci/magic-modules/downstream_changelog_metadata.py index b1d3643c9bda..39ab17c30301 100755 --- a/.ci/magic-modules/downstream_changelog_metadata.py +++ b/.ci/magic-modules/downstream_changelog_metadata.py @@ -11,7 +11,7 @@ unset. """ from pyutils import strutils, downstreams -from github import Github +import github import os import sys import argparse @@ -53,13 +53,13 @@ def downstream_changelog_info(gh, upstream_pr_num, changelog_repos): for repo_name, pulls in parsed_urls: print "Found downstream PR for repo %s" % repo_name - + if repo_name not in changelog_repos: print "[DEBUG] skipping repo %s with no CHANGELOG" % repo_name continue print "Generating changelog for pull requests in %s" % repo_name - + print "Fetching repo %s" % repo_name ghrepo = gh.get_repo(repo_name) @@ -95,9 +95,13 @@ def set_changelog_info(gh_pull, release_note, labels_to_add): print "Skipping, no downstreams repos given to downstream changelog info for" sys.exit(0) - gh = Github(os.environ.get('GITHUB_TOKEN')) - + gh = github.Github(os.environ.get('GITHUB_TOKEN')) assert len(sys.argv) == 2, "expected id filename as argument" with open(sys.argv[1]) as f: pr_num = int(f.read()) - downstream_changelog_info(gh, pr_num, downstream_repos) + + try: + downstream_changelog_info(gh, pr_num, downstream_repos) + except github.GithubException.GithubException as e: + print "Error while trying to downstream changelog info: %s", e + raise e diff --git a/.ci/magic-modules/pyutils/downstreams.py b/.ci/magic-modules/pyutils/downstreams.py index 7f1a2be941d4..aa6d68a8bb47 100644 --- a/.ci/magic-modules/pyutils/downstreams.py +++ b/.ci/magic-modules/pyutils/downstreams.py @@ -81,9 +81,8 @@ def get_downstream_urls(client, pr_num): List of downstream PR URLs. """ urls = [] + print "Getting downstream URLs for PR %d..." % pr_num pr = client.get_repo(UPSTREAM_REPO).get_pull(pr_num) for comment in pr.get_issue_comments(): urls = urls + find_dependency_urls_in_comment(comment.body) return urls - -