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
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")