File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 22Author: LetMeFly
33Date: 2022-07-03 11:21:14
44LastEditors: LetMeFly
5- LastEditTime: 2023-08-13 07:49:50
5+ LastEditTime: 2023-10-20 11:55:12
66Command: python newSolution.py 102. 二叉树的层序遍历
77What's more: 当前仅支持数字开头的题目
88'''
9+ import os
910import sys
1011import time
1112from urllib .parse import quote
@@ -70,6 +71,12 @@ def refreshPublistTime(solution: str) -> solution:
7071solutionName = "Solutions/LeetCode {0:04d}.{1}.md" .format (num , title )
7172with open (solutionName , "x" , encoding = "utf-8" ) as f :
7273 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+
7380print ("请编辑题解: “{0}”,注意不要更改文件前5行" .format (solutionName ))
7481
7582print ("请去掉可能的由其他插件自动生成的头部注释信息,并保存你所编辑的题解" )
@@ -145,3 +152,10 @@ def getProblemUrl():
145152print (readme )
146153with open ("README.md" , "w" , encoding = "utf-8" ) as f :
147154 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+ os .system (f'gh pr create -t "添加了问题“{ num } .{ title } ”的代码和题解" -b "By newSolution.py using GH"' )
161+ os .system (f'gh pr merge { issueNum } -m -d' )
You can’t perform that action at this time.
0 commit comments