athul / waka-readme

Wakatime Weekly Metrics on your Profile Readme.

Home Page:https://github.com/athul

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This doesn't seem to be working when your main branch is named `main` instead of `master`

BirjuVachhani opened this issue · comments

I recently implemented this in my profile and it worked very well. However yesterday, I changed my main branch from master to main as Github is planning to do so by the end of this year. Now I see that the job I have set for this is failing. It says that the branch master was not found,

Here's the stacktrace:

Traceback (most recent call last):
  File "/main.py", line 100, in <module>
    repo.update_file(path=contents.path, message=commit_message,
  File "/usr/local/lib/python3.8/site-packages/github/Repository.py", line 2098, in update_file
    headers, data = self._requester.requestJsonAndCheck(
  File "/usr/local/lib/python3.8/site-packages/github/Requester.py", line 317, in requestJsonAndCheck
    return self.__check(
  File "/usr/local/lib/python3.8/site-packages/github/Requester.py", line 342, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 404 {"message": "Branch master not found", "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}

Hello @BirjuVachhani, I created a PR that should solve this and tested it on my fork. However you can also test on your side to confirm.