diff --git a/.github/scripts/generate-prdoc.py b/.github/scripts/generate-prdoc.py index f05d517a5802..73fd05a2552d 100644 --- a/.github/scripts/generate-prdoc.py +++ b/.github/scripts/generate-prdoc.py @@ -7,7 +7,7 @@ This will delete any prdoc that already exists for the PR if `--force` is passed. Usage: - python generate-prdoc.py --pr 1234 --audience "TODO" --bump "TODO" + python generate-prdoc.py --pr 1234 --audience "Node Dev" --bump "patch" """ import argparse @@ -111,21 +111,20 @@ def yaml_multiline_string_presenter(dumper, data): # parse_args is also used by cmd/cmd.py def setup_parser(parser=None): + 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("--audience", type=str, default="TODO", help="The audience of whom the changes may concern.") - parser.add_argument("--bump", type=str, default="TODO", help="A default bump level for all crates.") - parser.add_argument("--force", type=str, help="Whether to overwrite any existing PrDoc.") - + 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.") return parser def main(args): - force = True if (args.force or "false").lower() == "true" else False - print(f"Args: {args}, force: {force}") + print(f"Args: {args}, force: {args.force}") setup_yaml() try: - from_pr_number(args.pr, args.audience, args.bump, force) + from_pr_number(args.pr, args.audience, args.bump, args.force) return 0 except Exception as e: print(f"Error generating prdoc: {e}") diff --git a/.github/workflows/cmd.yml b/.github/workflows/cmd.yml index e416b1202691..ecd339490059 100644 --- a/.github/workflows/cmd.yml +++ b/.github/workflows/cmd.yml @@ -152,7 +152,7 @@ jobs: id: get-pr-comment with: text: ${{ github.event.comment.body }} - regex: '^(\/cmd )([-\/\s\w.=:]+)$' # see explanation in docs/contributor/commands-readme.md#examples + regex: "^(\\/cmd )([-\\/\\s\\w.=:'\"]+)$" # see explanation in docs/contributor/commands-readme.md#examples - name: Save output of help id: help @@ -291,7 +291,7 @@ jobs: id: get-pr-comment with: text: ${{ github.event.comment.body }} - regex: '^(\/cmd )([-\/\s\w.=:]+)$' # see explanation in docs/contributor/commands-readme.md#examples + regex: "^(\\/cmd )([-\\/\\s\\w.=:'\"]+)$" # see explanation in docs/contributor/commands-readme.md#examples - name: Build workflow link if: ${{ !contains(github.event.comment.body, '--quiet') }} diff --git a/docs/contributor/commands-readme.md b/docs/contributor/commands-readme.md index 861c3ac784d5..761b975bf719 100644 --- a/docs/contributor/commands-readme.md +++ b/docs/contributor/commands-readme.md @@ -41,7 +41,8 @@ the default branch. ### Examples -The regex in cmd.yml is: `^(\/cmd )([-\/\s\w.=:]+)$` accepts only alphanumeric, space, "-", "/", "=", ":", "." chars. +The regex in cmd.yml is: `^(\/cmd )([-\/\s\w.=:'"]+)$` accepts only alphanumeric, space, "-", "/", "=", ":", ".", '"' chars. `/cmd bench --runtime bridge-hub-westend --pallet=pallet_name` +`/cmd prdoc --pr 5924 --audience "Node Dev" "Node Operator" --bump "patch"` `/cmd update-ui --image=docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v202407161507 --clean`