Skip to content

Commit

Permalink
make --pr optional for /cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax committed Oct 4, 2024
1 parent 7fa9806 commit cdf29e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/cmd/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
spec.loader.exec_module(generate_prdoc)

parser_prdoc = subparsers.add_parser('prdoc', help='Generates PR documentation')
generate_prdoc.setup_parser(parser_prdoc)
generate_prdoc.setup_parser(parser_prdoc, pr_required=False)

def main():
global args, unknown, runtimesMatrix
Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/generate-prdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ def yaml_multiline_string_presenter(dumper, data):
yaml.add_representer(str, yaml_multiline_string_presenter)

# parse_args is also used by cmd/cmd.py
def setup_parser(parser=None):
# if pr_required is False, then --pr is optional, as it can be derived from the PR comment body
def setup_parser(parser=None, pr_required=True):
allowed_audiences = ["runtime_dev", "runtime_user", "node_dev", "node_operator"]
if parser is None:
parser = argparse.ArgumentParser()
parser.add_argument("--pr", type=int, required=True, help="The PR number to generate the PrDoc for.")
parser.add_argument("--pr", type=int, required=pr_required, help="The PR number to generate the PrDoc for.")
parser.add_argument("--audience", type=str, nargs='*', choices=allowed_audiences, default=["todo"], help="The audience of whom the changes may concern. Example: --audience runtime_dev node_dev")
parser.add_argument("--bump", type=str, default="major", choices=["patch", "minor", "major", "silent", "ignore", "no_change"], help="A default bump level for all crates. Example: --bump patch")
parser.add_argument("--force", action="store_true", help="Whether to overwrite any existing PrDoc.")
Expand Down

0 comments on commit cdf29e8

Please sign in to comment.