-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaipush.py
More file actions
41 lines (32 loc) · 1.15 KB
/
aipush.py
File metadata and controls
41 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from Standards.Python import *
from Standards.SubProcess import *
commits = SubProcess_return_initialize(f"git log -1 --pretty=%B")
loop = 0
last_commit_message = ""
while loop < Python_return_length(commits):
last_commit_message += commits[loop]
if commits[loop] == "\n":
break
loop += 1
branch_name = last_commit_message[:50]
branch_name = Python_return_replace(branch_name, " ", "-")
branch_name = Python_return_lowercase(branch_name)
# Return only the English letters and hyphens.
loop = 0
branch_name_for_push = ""
while loop < Python_return_length(branch_name):
character = branch_name[loop]
# Check the character against the ASCII ranges for A-Z and a-z
# 65-90 is 'A' through 'Z'
# 97-122 is 'a' through 'z'
if (
('A' <= character <= 'Z')
or ('a' <= character <= 'z')
or (character == "-")
):
branch_name_for_push += character
loop += 1
SubProcess_initialize(f"git checkout -b {branch_name_for_push}")
SubProcess_initialize(f"git push -u origin {branch_name_for_push}")
SubProcess_initialize(f"gh pr create --fill")
Python_print(f"Pushed and switched to: {branch_name_for_push}")