Skip to content

Commit

Permalink
Merge branch 'main' into bug/compdef-types
Browse files Browse the repository at this point in the history
  • Loading branch information
jpower432 authored Mar 19, 2024
2 parents 873907f + b9af089 commit 34bb0e2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
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
17 changes: 5 additions & 12 deletions actions/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@
# Manage newest git versions (related to CVE https://github.blog/2022-04-12-git-security-vulnerability-announced/)
#
function set_git_safe_directory() {
if [[ -z "${GITHUB_WORKSPACE+x}" ]]; then
echo "Setting git safe.directory default: /github/workspace ..."
git config --global --add safe.directory /github/workspace
if [[ -z "${GITHUB_WORKSPACE}" ]]; then
echo "GITHUB_WORKSPACE is not set. Exiting..."
exit 1
else
echo "Setting git safe.directory GITHUB_WORKSPACE: $GITHUB_WORKSPACE ..."
git config --global --add safe.directory "$GITHUB_WORKSPACE"
fi

if [[ -z "${INPUT_REPOSITORY+x}" ]]; then
echo "Skipping setting working directory as safe directory"
else
echo "Setting git safe.directory default: $INPUT_REPOSITORY ..."
git config --global --add safe.directory "$INPUT_REPOSITORY"
echo "Setting git safe.directory GITHUB_WORKSPACE: $GITHUB_WORKSPACE ..."
git config --global --add safe.directory "$GITHUB_WORKSPACE"
fi
}

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 34bb0e2

Please sign in to comment.