@@ -34,6 +34,12 @@ def extract_gitref(s):
3434 action = "store_true" ,
3535 help = "Escape output for GitHub Action" ,
3636)
37+ parser .add_argument (
38+ "--max-commits" ,
39+ type = int ,
40+ default = 100 ,
41+ help = "Maximum number of commits to check" ,
42+ )
3743
3844args = parser .parse_args ()
3945
@@ -45,16 +51,21 @@ def extract_gitref(s):
4551
4652prs = set ()
4753git_compare = r .compare (start , end )
48- for c in git_compare .commits :
49- s = gh .search_issues ("" , type = "pr" , repo = args .repo , sha = c .sha )
50- prs .update (s )
51-
54+ commits = list (git_compare .commits )
55+ if len (commits ) > args .max_commits :
56+ pr_summaries = [
57+ f"{ len (commits )} commits between { start } and { end } , not searching for PRs"
58+ ]
59+ else :
60+ for c in commits :
61+ prs .update (c .get_pulls ())
62+ pr_summaries = [
63+ f"- [#{ pr .number } ]({ pr .html_url } ) { pr .title } "
64+ for pr in sorted (prs , key = lambda pr : pr .number )
65+ ]
5266
53- pr_summaries = [
54- f"- [#{ pr .number } ]({ pr .html_url } ) { pr .title } "
55- for pr in sorted (prs , key = lambda pr : pr .number )
56- ]
67+ md = ["# PRs" ] + pr_summaries + ["" , f"{ r .html_url } /compare/{ start } ...{ end } " ]
5768if args .github_action_escape :
58- print ("%0A" .join (pr_summaries ))
69+ print ("%0A" .join (md ))
5970else :
60- print ("\n " .join (pr_summaries ))
71+ print ("\n " .join (md ))
0 commit comments