From 57395d3c281a112a6c521093a8d95051ffc3d902 Mon Sep 17 00:00:00 2001 From: Swenchao Date: Wed, 14 Oct 2020 16:49:52 +0800 Subject: [PATCH 1/2] update branch name --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 392ecce..e512bc6 100644 --- a/main.py +++ b/main.py @@ -508,7 +508,7 @@ if __name__ == '__main__': committer = InputGitAuthor('readme-bot', 'readme-bot@example.com') if new_readme != rdmd: repo.update_file(path=contents.path, message='Updated with Dev Metrics', - content=new_readme, sha=contents.sha, branch='master', + content=new_readme, sha=contents.sha, branch='main', committer=committer) print("Readme updated") except Exception as e: From cf51aa90961db7d0ffc4bcbe5e3e85872bec5a1a Mon Sep 17 00:00:00 2001 From: Swenchao Date: Thu, 15 Oct 2020 15:55:09 +0800 Subject: [PATCH 2/2] update:fix the branch name --- main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e512bc6..f8e7ab2 100644 --- a/main.py +++ b/main.py @@ -507,9 +507,14 @@ if __name__ == '__main__': new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) committer = InputGitAuthor('readme-bot', 'readme-bot@example.com') if new_readme != rdmd: - repo.update_file(path=contents.path, message='Updated with Dev Metrics', - content=new_readme, sha=contents.sha, branch='main', - committer=committer) + try: + repo.update_file(path=contents.path, message='Updated with Dev Metrics', + content=new_readme, sha=contents.sha, branch='master', + committer=committer) + except: + repo.update_file(path=contents.path, message='Updated with Dev Metrics', + content=new_readme, sha=contents.sha, branch='main', + committer=committer) print("Readme updated") except Exception as e: traceback.print_exc()