|
2 | 2 | Author: LetMeFly |
3 | 3 | Date: 2022-07-03 11:21:14 |
4 | 4 | LastEditors: LetMeFly |
5 | | -LastEditTime: 2023-08-13 07:49:50 |
| 5 | +LastEditTime: 2023-10-20 11:59:02 |
6 | 6 | Command: python newSolution.py 102. 二叉树的层序遍历 |
7 | 7 | What's more: 当前仅支持数字开头的题目 |
8 | 8 | ''' |
| 9 | +import os |
9 | 10 | import sys |
10 | 11 | import time |
11 | 12 | from urllib.parse import quote |
@@ -70,6 +71,12 @@ def refreshPublistTime(solution: str) -> solution: |
70 | 71 | solutionName = "Solutions/LeetCode {0:04d}.{1}.md".format(num, title) |
71 | 72 | with open(solutionName, "x", encoding="utf-8") as f: |
72 | 73 | f.write(solution) |
| 74 | + |
| 75 | +# 认领issue |
| 76 | +os.system(f'git checkout -b {num}') |
| 77 | +issueCreateResult = os.popen(f'gh issue create -t "Add 1 more problem of {num}"').read() |
| 78 | +issueNum = int(issueCreateResult.split('\n')[0].split('/')[-1]) |
| 79 | + |
73 | 80 | print("请编辑题解: “{0}”,注意不要更改文件前5行".format(solutionName)) |
74 | 81 |
|
75 | 82 | print("请去掉可能的由其他插件自动生成的头部注释信息,并保存你所编辑的题解") |
@@ -145,3 +152,12 @@ def getProblemUrl(): |
145 | 152 | print(readme) |
146 | 153 | with open("README.md", "w", encoding="utf-8") as f: |
147 | 154 | f.write(readme) |
| 155 | + |
| 156 | +# commit push pr merge delete-branch |
| 157 | +os.system('git add .') |
| 158 | +os.system(f'git commit -m "添加了问题“{num}.{title}”的代码和题解"') |
| 159 | +os.system(f'git push --set-upstream origin {num}') |
| 160 | +prResult = os.popen(f'gh pr create -t "添加了问题“{num}.{title}”的代码和题解" -b "By newSolution.py using GH | close: #{issueNum}"').read() |
| 161 | +print(prResult) |
| 162 | +prNumber = int(prResult.split('/')[-1]) |
| 163 | +os.system(f'gh pr merge {prNumber} -m -d') |
0 commit comments