Skip to content

Commit ed45e5f

Browse files
authored
Merge pull request #2 from msyyc/create_pr
create create_auto_release_pr.py
2 parents 6223585 + bb9479e commit ed45e5f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import os
2+
import argparse
3+
import logging
4+
5+
from ghapi.all import GhApi
6+
7+
8+
ISSUE_LINK = ''
9+
PULL_NUMBER = 0
10+
NEW_BRANCH = ''
11+
TARGET_BRANCH = ''
12+
13+
_LOG = logging.getLogger()
14+
USER_TOKEN = os.getenv('USER_TOKEN', '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')
15+
16+
17+
def create_auto_release_pr(api):
18+
pr_title = "[AutoRelease] {}(Do not merge)".format(NEW_BRANCH)
19+
pr_head = "{}:{}".format(USER_NAME, NEW_BRANCH)
20+
pr_base = TARGET_BRANCH
21+
pr_body = "issue link {}".format(ISSUE_LINK)
22+
23+
res_create = api.pulls.create(pr_title, pr_head, pr_base, pr_body)
24+
print(res_create)
25+
26+
27+
def get_pr_number():
28+
pass
29+
30+
31+
def main():
32+
api = GhApi(owner='Azure', repo='azure-sdk-for-python', token=USER_TOKEN)
33+
34+
pr = create_auto_release_pr(api)
35+
return
36+
37+
api.pulls.update(pull_number=20050, body='https://github.com/Azure/sdk-release-request/issues/1739')
38+
# api.pulls.update(pull_number=PULL_NUMBER, body=ISSUE_LINK)
39+
40+
41+
42+
if __name__ == '__main__':
43+
parser = argparse.ArgumentParser(
44+
description='Add Issue link',
45+
formatter_class=argparse.RawTextHelpFormatter)
46+
47+
parser.add_argument("new_branch", help="new branch for SDK")
48+
parser.add_argument("target_branch", help="target branch for SDK")
49+
parser.add_argument("user_name", help="user name")
50+
parser.add_argument("issue_link", help="issue link")
51+
args = parser.parse_args()
52+
53+
main_logger = logging.getLogger()
54+
logging.basicConfig()
55+
main_logger.setLevel(logging.INFO)
56+
57+
NEW_BRANCH = args.new_branch
58+
TARGET_BRANCH = args.target_branch
59+
USER_NAME = args.user_name
60+
ISSUE_LINK = args.issue_link
61+
62+
63+
main()
64+
# python create_auto_release_pr.py "$(new_branch)" "$(target_branch)" $USER_NAME $ISSUE_LINK

0 commit comments

Comments
 (0)