Esempio n. 1
0
def _get_pr_numbers(last_deploy, current_deploy):
    repo = Github().get_organization('dimagi').get_repo('commcare-hq')
    last_deploy_sha = repo.get_commit(last_deploy).sha
    current_deploy_sha = repo.get_commit(current_deploy).sha
    comparison = repo.compare(last_deploy_sha, current_deploy_sha)

    return [
        int(re.search(r'Merge pull request #(\d+)', repo_commit.commit.message).group(1))
        for repo_commit in comparison.commits
        if repo_commit.commit.message.startswith('Merge pull request')
    ]
Esempio n. 2
0
def _get_pr_numbers(last_deploy, current_deploy):
    repo = Github().get_organization('dimagi').get_repo('commcare-hq')
    last_deploy_sha = repo.get_commit(last_deploy).sha
    current_deploy_sha = repo.get_commit(current_deploy).sha
    comparison = repo.compare(last_deploy_sha, current_deploy_sha)

    return [
        int(
            re.search(r'Merge pull request #(\d+)',
                      repo_commit.commit.message).group(1))
        for repo_commit in comparison.commits
        if repo_commit.commit.message.startswith('Merge pull request')
    ]
Esempio n. 3
0
                    type=str,
                    help="Changelog is generated for this release range")
args = parser.parse_args()

if args.token is None:
    raise Exception("GitHub Token must be set")
try:
    previous_release = args.range.split("..")[0]
    current_release = args.range.split("..")[1]
except Exception:
    raise Exception(
        "Release range must be set in this format: v0.11.0..v0.12.0")

# Get list of commits from the range.
github_repo = Github(args.token).get_repo(REPO_NAME)
comparison = github_repo.compare(previous_release, current_release)
commits = comparison.commits

# The latest commit contains the release date.
release_date = str(commits[-1].commit.author.date).split(" ")[0]
release_url = "https://github.com/{}/tree/{}".format(REPO_NAME,
                                                     current_release)

# Get all PRs in reverse chronological order from the commits.
pr_list = ""
pr_set = set()
for commit in reversed(commits):
    # Only add commits with PRs.
    for pr in commit.get_pulls():
        # Each PR is added only one time to the list.
        if pr.number in pr_set: