waka-readme-stats icon indicating copy to clipboard operation
waka-readme-stats copied to clipboard

FEAT: Custom committer name and email

Open yanyongyu opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

GitHub API will return an empty email if user turned on Keep my email addresses private. In this case, COMMIT BY ME will fail to update file content with the following exception.

Traceback (most recent call last):
  File "/main.py", line 571, in <module>
    repo.update_file(path=contents.path, message=commit_message,
  File "/usr/local/lib/python3.9/site-packages/github/Repository.py", line 2121, in update_file
    headers, data = self._requester.requestJsonAndCheck(
  File "/usr/local/lib/python3.9/site-packages/github/Requester.py", line 315, in requestJsonAndCheck
    return self.__check(
  File "/usr/local/lib/python3.9/site-packages/github/Requester.py", line 340, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 422 {"message": "Validation Failed", "errors": [{"resource": "committer", "code": "missing_field", "field": "email"}], "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}

Describe the solution you'd like

Provide a way to custom username and email?

Describe alternatives you've considered

Use user's username and email if COMMIT_BY_ME is True, else use user custom username and email if provided. Defaults to github actions bot.

yanyongyu avatar Jun 15 '22 03:06 yanyongyu

@yanyongyu I noticed you are committing with [email protected]. Do you have Keep my email addresses private turned on and Block command line pushes that expose my email turned off?

aravindvnair99 avatar Jun 15 '22 05:06 aravindvnair99

@yanyongyu I noticed you are committing with [email protected]. Do you have Keep my email addresses private turned on and Block command line pushes that expose my email turned off?

I turned on Keep my email addresses private and turned off lock command line pushes that expose my email for a long time and never change it. but i noticed that action pushed content failed since 6/11. i tried to query gh api with my PAT token and got email to be null.

yanyongyu avatar Jun 15 '22 05:06 yanyongyu