From ddd0adec256cef23fe6ba0e0790a092f01072218 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Wed, 5 Jul 2023 12:36:42 -0400 Subject: [PATCH] chore: updates patterns to take a single input from the trestlebot CLI Signed-off-by: Jennifer Power --- entrypoint.sh | 24 ++++++++++++------------ tests/trestlebot/test_cli.py | 2 +- trestlebot/cli.py | 9 ++++----- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4afe816c..2e69aceb 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -26,18 +26,18 @@ trap exec 3>&- EXIT # Initialize the command variable command="python3.8 -m trestlebot \ - --markdown-path=${INPUT_MARKDOWN_PATH} \ - --oscal-model=${INPUT_OSCAL_MODEL} \ - --ssp-index-path=${INPUT_SSP_INDEX_PATH} \ - --commit-message=${INPUT_COMMIT_MESSAGE} \ - --branch=${INPUT_BRANCH} \ - --patterns=${INPUT_FILE_PATTERN} \ - --committer-name=${INPUT_COMMIT_USER_NAME} \ - --committer-email=${INPUT_COMMIT_USER_EMAIL} \ - --author-name=${INPUT_COMMIT_AUTHOR_NAME} \ - --author-email=${INPUT_COMMIT_AUTHOR_EMAIL} \ - --skip-items=${INPUT_SKIP_ITEMS} \ - --working-dir=${INPUT_REPOSITORY}" + --markdown-path=\"${INPUT_MARKDOWN_PATH}\" \ + --oscal-model=\"${INPUT_OSCAL_MODEL}\" \ + --ssp-index-path=\"${INPUT_SSP_INDEX_PATH}\" \ + --commit-message=\"${INPUT_COMMIT_MESSAGE}\" \ + --branch=\"${INPUT_BRANCH}\" \ + --file-pattern=\"${INPUT_FILE_PATTERN}\" \ + --committer-name=\"${INPUT_COMMIT_USER_NAME}\" \ + --committer-email=\"${INPUT_COMMIT_USER_EMAIL}\" \ + --author-name=\"${INPUT_COMMIT_AUTHOR_NAME}\" \ + --author-email=\"${INPUT_COMMIT_AUTHOR_EMAIL}\" \ + --working-dir=\"${INPUT_REPOSITORY}\" \ + --skip-items=\"${INPUT_SKIP_ITEMS}\"" # Conditionally include flags if [[ ${INPUT_SKIP_ASSEMBLE} == true ]]; then diff --git a/tests/trestlebot/test_cli.py b/tests/trestlebot/test_cli.py index b67c55d7..e72792f4 100644 --- a/tests/trestlebot/test_cli.py +++ b/tests/trestlebot/test_cli.py @@ -34,7 +34,7 @@ def valid_args_dict() -> dict: "committer-name": "test", "committer-email": "test@email.com", "working-dir": "tmp", - "patterns": ".", + "file-pattern": ".", } diff --git a/trestlebot/cli.py b/trestlebot/cli.py index e1e925ff..9a9912a0 100644 --- a/trestlebot/cli.py +++ b/trestlebot/cli.py @@ -57,11 +57,10 @@ def _parse_cli_arguments() -> argparse.Namespace: help="OSCAL model type to run tasks on. Values can be catalog, profile, compdef, or ssp", ) parser.add_argument( - "--patterns", - nargs="+", - type=str, + "--file-pattern", required=True, - help="List of file patterns to include in repository updates", + type=str, + help="File pattern to be used with `git add` in repository updates", ) parser.add_argument( "--skip-items", @@ -211,7 +210,7 @@ def run() -> None: author_name=args.author_name, author_email=args.author_email, pre_tasks=pre_tasks, - patterns=args.patterns, + patterns=[args.file_pattern], check_only=args.check_only, )