PyGithub `Repository.compare(base, head)` not working

335 views Asked by At

I am trying to run a compare in out GitHub Enterprise Repo with PyGitHub. My Code looks like this:

repo = github.get_repo("my/repo")
log.debug(f"The Repo: {repo}")
log.debug(f"The URL: {repo.compare_url}")

labels = repo.get_labels()
log.debug(f"Labels: {labels.totalCount}")

compare = repo.compare("BRANCH_A", "TAG_B")
log.debug("Compare:\n{compare}")

As Result I get this:

2020-10-08:13:38:15,349 DEBUG    [changelog.py:50] The Repo: Repository(full_name="my/repo")
2020-10-08:13:38:15,349 DEBUG    [changelog.py:51] The URL: https://<my.enterprise-github.host>/api/v3/repos/my/repo/compare/{base}...{head}
2020-10-08:13:38:15,446 DEBUG    [changelog.py:54] Labels: 13
2020-10-08:13:38:16,114 DEBUG    [changelog.py:57] Compare:
{compare}

If I run the URL printed out in line 3 with correct Parameters (https://<my.enterprise-github.host>/api/v3/repos/my/repo/compare/BRANCH_A...TAG_B) with insomnia, I am getting the right result. Do you have any hints, why Repository.compare in PyGitHub is not working?

1

There are 1 answers

0
keineantwort On BEST ANSWER

Ok. This question is a result of my python-noob-level:

I forgot to format the Log-String, in which I wanted to show the Compare-Result:

log.debug(**f**"Compare:\n{compare}")