예제 #1
0
파일: github.py 프로젝트: mozilla/task-boot
def build_release_notes(repository: Repository.Repository,
                        tag: GitRef.GitRef) -> str:
    signature = (
        "\n---\nReleased with [mozilla/task-boot](https://github.com/mozilla/task-boot)"
    )

    # Get all commits between both versions using the comparison endpoint
    try:
        latest_release = repository.get_latest_release()
        diff = repository.compare(latest_release.tag_name, tag.ref)
        commits = diff.commits
    except UnknownObjectException:
        logger.info(
            "No previous release available, will use all commits on repo")
        commits = [commit for commit in repository.get_commits()]

    # List existing tags sha
    tags = [tag.commit.sha for tag in repository.get_tags()]

    # Use first line of every commit in between versions
    lines = [
        "- {}".format(commit.commit.message.splitlines()[0])
        for commit in commits if not is_release_commit(commit, tags)
    ]

    return "\n".join(lines) + signature
예제 #2
0
def get_latest_release(repo: Repository):
    print("getting: " + repo.name)
    try:
        release = repo.get_latest_release()
        print("  found")
        return release
    except GithubException as e:
        print("  not found")