-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathprocess-pull-request
More file actions
executable file
·49 lines (40 loc) · 1.06 KB
/
process-pull-request
File metadata and controls
executable file
·49 lines (40 loc) · 1.06 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
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
"""
Process a PR given a repository and PR id number.
"""
import os
import argparse
from socket import setdefaulttimeout
from github import Github
from Mu2eCI import config
from Mu2eCI.common import api_rate_limits
from Mu2eCI.process_pr import process_pr
setdefaulttimeout(120)
parser = argparse.ArgumentParser(
description="Process a pull request given a repository and PR number."
)
parser.add_argument(
"repo",
type=str,
help="The GitHub repository. Must be in the format e.g. Mu2e/Offline",
choices=config.main["supported_repos"],
)
parser.add_argument("pr_id", type=int, help="The Pull Request ID.")
parser.add_argument(
"--dry-run",
type=bool,
default=False,
help="Is this a dry run? i.e. don't touch GitHub.",
)
args = parser.parse_args()
if __name__ == "__main__":
prId = args.pr_id
gh = Github(login_or_token=os.environ["GITHUBTOKEN"], retry=3)
api_rate_limits(gh)
repo = gh.get_repo(args.repo)
process_pr(
gh,
repo,
repo.get_issue(prId),
args.dry_run,
)