22from typing import Dict , List , Set
33
44import requests
5+ from six import b
56
67
78GITHUB_TOKEN : str = os .getenv ("GITHUB_TOKEN" )
@@ -49,6 +50,12 @@ def find_contributors_to_branch(repository: str, head_branch: str, base_branch:
4950 dest = "base_branch" ,
5051 help = "base branch for comparison" ,
5152 )
53+ parser .add_argument (
54+ "--should-add-reviewers" ,
55+ dest = "should_add_reviewers" ,
56+ help = "if should add reviewers to PR" ,
57+ type = bool ,
58+ )
5259 parser .add_argument (
5360 "--required-reviewers" ,
5461 dest = "required_reviewers" ,
@@ -57,11 +64,12 @@ def find_contributors_to_branch(repository: str, head_branch: str, base_branch:
5764
5865 args = parser .parse_args ()
5966
60- # find contributors to branch
61- contributors : Set [str ] = find_contributors_to_branch (args .repository , args .head_branch , args .base_branch )
67+ if args .should_add_reviewers :
68+ # find contributors to branch
69+ contributors : Set [str ] = find_contributors_to_branch (args .repository , args .head_branch , args .base_branch )
6270
63- # output reviewers as comma delimited list
64- reviewers = contributors | set (args .required_reviewers .split ("," ))
65- print ("," .join (reviewers ))
71+ # output reviewers as comma delimited list
72+ reviewers = contributors | set (args .required_reviewers .split ("," ))
73+ print ("," .join (reviewers ))
6674
6775 exit (0 )
0 commit comments