Skip to content

Commit

Permalink
feat: adds version flag to autosync command for assembly task (#187)
Browse files Browse the repository at this point in the history
Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 authored Mar 12, 2024
1 parent 983384e commit b9af089
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions actions/autosync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ name: Example Workflow
| oscal_model | OSCAL Model type to assemble. Values can be catalog, profile, compdef, or ssp. | None | True |
| check_only | Runs tasks and exits with an error if there is a diff. Defaults to false | false | False |
| github_token | GitHub token used to make authenticated API requests | None | False |
| version | Version of the OSCAL model to set during assembly into JSON. | 1.0.0 | False |
| skip_assemble | Skip assembly task. Defaults to false | false | False |
| skip_regenerate | Skip regenerate task. Defaults to false. | false | False |
| skip_items | Comma-separated glob patterns list of content by trestle name to skip during task execution. For example `profile_x,profile_y*,`. | None | False |
Expand Down
4 changes: 4 additions & 0 deletions actions/autosync/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ inputs:
github_token:
description: "GitHub token used to make authenticated API requests"
required: false
version:
description: "Version of the OSCAL model to set during assembly into JSON."
required: false
default: "1.0.0"
skip_assemble:
description: "Skip assembly task. Defaults to false"
required: false
Expand Down
3 changes: 2 additions & 1 deletion actions/autosync/auto-sync-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ command="trestlebot-autosync \
--author-email=\"${INPUT_COMMIT_AUTHOR_EMAIL}\" \
--working-dir=\"${INPUT_REPOSITORY}\" \
--target-branch=\"${INPUT_TARGET_BRANCH}\" \
--skip-items=\"${INPUT_SKIP_ITEMS}\""
--skip-items=\"${INPUT_SKIP_ITEMS}\" \
--version=\"${INPUT_VERSION}\""

# Conditionally include flags
if [[ ${INPUT_SKIP_ASSEMBLE} == true ]]; then
Expand Down
1 change: 1 addition & 0 deletions tests/trestlebot/entrypoints/test_autosync.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def valid_args_dict() -> Dict[str, str]:
"committer-email": "[email protected]",
"working-dir": ".",
"file-patterns": ".",
"version": "0.1.0",
}


Expand Down
7 changes: 7 additions & 0 deletions trestlebot/entrypoints/autosync.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def setup_autosync_arguments(self) -> None:
help="Comma-separated list of glob patterns of the chosen model type to skip when running \
tasks",
)
self.parser.add_argument(
"--version",
type=str,
required=False,
help="Version of the OSCAL model to set during assembly into JSON.",
)
self.parser.add_argument(
"--skip-assemble",
required=False,
Expand Down Expand Up @@ -134,6 +140,7 @@ def run(self, args: argparse.Namespace) -> None:
assemble_task: AssembleTask = AssembleTask(
authored_object=authored_object,
markdown_dir=args.markdown_path,
version=args.version,
model_filter=model_filter,
)
pre_tasks.append(assemble_task)
Expand Down

0 comments on commit b9af089

Please sign in to comment.