diff --git a/.github/actions/action-00-toolbox/action.yml b/.github/actions/action-00-toolbox/action.yml index f5ed646..b2bcc9e 100644 --- a/.github/actions/action-00-toolbox/action.yml +++ b/.github/actions/action-00-toolbox/action.yml @@ -13,6 +13,6 @@ runs: using: "composite" steps: - name: Toolbox - Install CICD-Tools Toolbox - uses: cicd-tools-org/cicd-tools/.github/actions/action-00-toolbox@master + uses: cicd-tools-org/cicd-tools/.github/actions/action-00-toolbox@main with: PROJECT_ROOT_PATH: ${{ inputs.PROJECT_ROOT_PATH }} diff --git a/.github/config/workflows/workflow-push.json b/.github/config/workflows/workflow-push.json index 4f1b3cf..ae00407 100644 --- a/.github/config/workflows/workflow-push.json +++ b/.github/config/workflows/workflow-push.json @@ -4,7 +4,7 @@ "ci_concurrency_limit": 4, "ci_extra_release_content": [ "### Release Checklist", - "- [] Ensure master is synchronized with the release tag." + "- [] Ensure main is synchronized with the release tag." ], "ci_python_versions": ["3.9"], "ci_trufflehog_extra_scan_args": "", diff --git a/.github/scripts/step-setup-environment.sh b/.github/scripts/step-setup-environment.sh index 3ff311d..3ec24d8 100755 --- a/.github/scripts/step-setup-environment.sh +++ b/.github/scripts/step-setup-environment.sh @@ -11,7 +11,7 @@ # PROJECT_NAME: The slugified name of the template project. Should match the GitHub repository name. # PROJECT_OWNER: The GitHub owner of the project. # PUSH_FALLBACK_REV_RANGE: The fallback value for linting commits with commitizen. This should be set to either "HEAD" (all commits) or the first compatible commit in your Git History. -# TEMPLATE_BRANCH_NAME_BASE: The name of the templated repository's default branch name. (Defaults to 'master'.) +# TEMPLATE_BRANCH_NAME_BASE: The name of the templated repository's default branch name. (Defaults to 'main'.) # TEMPLATE_BRANCH_NAME_DEVELOPMENT: The name of the templated repository's development branch name. (Defaults to 'dev'.) # CI only script. @@ -39,7 +39,7 @@ main() { echo "PROJECT_NAME=${PROJECT_NAME}" echo "PROJECT_OWNER=${PROJECT_OWNER}" echo "PUSH_FALLBACK_REV_RANGE=${PUSH_FALLBACK_REV_RANGE}" - echo "TEMPLATE_BRANCH_NAME_BASE=${TEMPLATE_BRANCH_NAME_BASE-master}" + echo "TEMPLATE_BRANCH_NAME_BASE=${TEMPLATE_BRANCH_NAME_BASE-main}" echo "TEMPLATE_BRANCH_NAME_DEVELOPMENT=${TEMPLATE_BRANCH_NAME_DEVELOPMENT-dev}" } >> "${GITHUB_ENV}" diff --git a/.github/workflows/workflow-push.yml b/.github/workflows/workflow-push.yml index 0b6911c..fad207c 100644 --- a/.github/workflows/workflow-push.yml +++ b/.github/workflows/workflow-push.yml @@ -15,14 +15,14 @@ on: jobs: configuration: - uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-read_json_file.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-read_json_file.yml@main with: JSON_FILE_PATH: ".github/config/workflows/workflow-push.json" start: secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@main with: NOTIFICATION_EMOJI: ":vertical_traffic_light:" NOTIFICATION_MESSAGE: "Workflow has started!" @@ -31,7 +31,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-10-generic-security_scan_credentials.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-10-generic-security_scan_credentials.yml@main with: EXTRA_BINARY_ARGS: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_trufflehog_extra_scan_args }} VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_verbose_notifications }} @@ -40,7 +40,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-30-generic-markdown_links.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-30-generic-markdown_links.yml@main with: CONFIG_FILE: ".github/config/actions/gaurav-nelson-github-action-markdown-link-check.json" VERBOSE_NOTIFICATIONS: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_verbose_notifications }} @@ -49,7 +49,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-50-poetry-test_basic_precommit_hooks.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-50-poetry-test_basic_precommit_hooks.yml@main with: CHECK_TOML: true CHECK_WORKFLOW: true @@ -61,7 +61,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-rev_range_command.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-rev_range_command.yml@main with: COMMAND: | poetry run cz check --rev-range "${PUSHED_COMMIT_REV_RANGE}" @@ -75,7 +75,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-rev_range_command.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-rev_range_command.yml@main with: COMMAND: | CICD_COMMIT_MESSAGES_FILE="$(mktemp XXXXXXXX.git_history_file)" @@ -91,7 +91,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@main with: CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} PRECOMMIT_HOOK_ID: "check-jsonschema" @@ -103,7 +103,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@main with: CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} PRECOMMIT_HOOK_ID: "lint-markdown" @@ -115,7 +115,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@main with: CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} PRECOMMIT_HOOK_ID: "spelling-markdown" @@ -127,7 +127,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@main with: CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} PRECOMMIT_HOOK_ID: "format-toml" @@ -148,7 +148,7 @@ jobs: - id: "lint-github-workflow-header" name: "Workflow Header Linting" max-parallel: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@main with: CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} PRECOMMIT_HOOK_ID: ${{ matrix.hook.id }} @@ -160,7 +160,7 @@ jobs: needs: [configuration] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-80-poetry-precommit_commit_stage_hook.yml@main with: CONCURRENCY: ${{ fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_concurrency_limit }} PRECOMMIT_HOOK_ID: "yamllint" @@ -174,7 +174,7 @@ jobs: needs: [commit_lint, commit_spell_check, configuration, json_schema_lint, markdown_links, markdown_lint, markdown_spelling, pre-commit_hooks, security, start, toml_lint, workflow_lint, yaml_lint] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-99-poetry-create_release.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-99-poetry-create_release.yml@main with: JSON_APPENDED_CONTENT: ${{ toJSON(fromJSON(needs.configuration.outputs.JSON_FILE_DATA).ci_extra_release_content) }} @@ -182,7 +182,7 @@ jobs: needs: [create_release] secrets: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@master + uses: cicd-tools-org/cicd-tools/.github/workflows/job-00-generic-notification.yml@main with: NOTIFICATION_EMOJI: ":checkered_flag:" NOTIFICATION_MESSAGE: "Workflow has completed successfully!" diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 5e1935f..1185f26 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -2,7 +2,7 @@ - id: format-shell name: format-shell description: "Format the project's shell scripts." - entry: --entrypoint=shfmt --env=FORCE_COLOR=1 ghcr.io/cicd-tools-org/cicd-tools:master + entry: --entrypoint=shfmt --env=FORCE_COLOR=1 ghcr.io/cicd-tools-org/cicd-tools:main args: - "-w" - "--indent=2" @@ -16,7 +16,7 @@ - id: format-toml name: format-toml description: "Format the project's TOML files." - entry: --entrypoint=tomll --env=FORCE_COLOR=1 ghcr.io/cicd-tools-org/cicd-tools:master + entry: --entrypoint=tomll --env=FORCE_COLOR=1 ghcr.io/cicd-tools-org/cicd-tools:main files: "^.+\\.toml$" language: docker_image pass_filenames: true @@ -31,14 +31,14 @@ - id: lint-dockerfile name: lint-dockerfile description: "Lint the project's Dockerfiles." - entry: --entrypoint=hadolint ghcr.io/cicd-tools-org/cicd-tools:master + entry: --entrypoint=hadolint ghcr.io/cicd-tools-org/cicd-tools:main types: ["dockerfile"] language: docker_image stages: [commit] - id: lint-github-workflow name: lint-github-workflow description: "Lint the project's GitHub workflow files." - entry: --entrypoint=actionlint ghcr.io/cicd-tools-org/cicd-tools:master + entry: --entrypoint=actionlint ghcr.io/cicd-tools-org/cicd-tools:main args: - "-color" - "-config-file" @@ -69,7 +69,7 @@ - id: lint-shell name: lint-shell description: "Lint the project's shell scripts." - entry: --entrypoint=shellcheck ghcr.io/cicd-tools-org/cicd-tools:master + entry: --entrypoint=shellcheck ghcr.io/cicd-tools-org/cicd-tools:main args: - "--color=always" - "--source-path=SCRIPTDIR" @@ -99,7 +99,7 @@ description: "Check the spelling on the commit message." entry: ./.cicd-tools/boxes/bootstrap/pre-commit/spelling-commit-message.sh args: - - "ghcr.io/cicd-tools-org/cicd-tools:master" + - "ghcr.io/cicd-tools-org/cicd-tools:main" language: system pass_filenames: true stages: [commit-msg] @@ -108,7 +108,7 @@ - id: spelling-markdown name: spelling-markdown description: "Spellcheck the Markdown files." - entry: --entrypoint=vale ghcr.io/cicd-tools-org/cicd-tools:master + entry: --entrypoint=vale ghcr.io/cicd-tools-org/cicd-tools:main files: "^.+\\.md$" language: docker_image pass_filenames: true @@ -116,7 +116,7 @@ - id: spelling-vale-synchronize name: spelling-vale-synchronize description: "Download any required vale packages." - entry: --mount type=tmpfs,destination=/tmp --entrypoint=vale ghcr.io/cicd-tools-org/cicd-tools:master + entry: --mount type=tmpfs,destination=/tmp --entrypoint=vale ghcr.io/cicd-tools-org/cicd-tools:main args: - "sync" language: docker_image diff --git a/README.md b/README.md index 76ccaec..038c567 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # Pre-Commit Hooks for CICD-Tools -(Powered by [CICD-Tools](https://github.com/cicd-tools-org/cicd-tools).) +[![cicd-tools](https://img.shields.io/badge/ci/cd:-cicd_tools-blue)](https://github.com/cicd-tools-org/cicd-tools) -This repository provides [pre-commit](https://pre-commit.com/) hooks for the [CICD-Tools](https://github.com/cicd-tools-org/cicd-tools) project. - -#### Master Branch (Follows the latest production tag) -[![workflow-link](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml/badge.svg?branch=master)](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml) +| Branch | Build | +|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [main](https://github.com/cicd-tools-org/pre-commit/tree/main) | [![workflow-link](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml/badge.svg?branch=main)](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml) | +| [dev](https://github.com/cicd-tools-org/pre-commit/tree/dev) | [![workflow-link](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml/badge.svg?branch=dev)](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml) | -#### Dev Branch -[![workflow-link](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml/badge.svg?branch=dev)](https://github.com/cicd-tools-org/pre-commit/actions/workflows/workflow-push.yml) +This repository provides [pre-commit](https://pre-commit.com/) hooks for the [CICD-Tools](https://github.com/cicd-tools-org/cicd-tools) project. ### Containerization and Pre-Commit @@ -37,19 +36,19 @@ These hooks all rely on 3rd party software to perform different types of static ### Implementation Details -| Hook Name | Exe Source | Implementation | -|-----------------------------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| format-shell | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | -| format-toml | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | -| lint-ansible | user project | A custom [CICD-Tools script](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/boxes/bootstrap/pre-commit/lint-ansible.sh) invokes ansible-lint in [poetry](https://python-poetry.org/). | -| lint-github-workflow | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | -| lint-github-workflow-header | shell | A custom [CICD-Tools script](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/boxes/bootstrap/pre-commit/lint-github-workflow-header.sh) is invoked. | -| lint-markdown | 3rd party | The official [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli/pkgs/container/markdownlint-cli) container is used to invoke this tool. | -| lint-shell | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | -| security-credentials | 3rd Party | The official [trufflehog](https://hub.docker.com/r/trufflesecurity/trufflehog/) container is used to invoke this tool. | -| spelling-commit-message | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | -| spelling-markdown | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | -| spelling-vale-synchronize | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/master/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| Hook Name | Exe Source | Implementation | +|-----------------------------|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| format-shell | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| format-toml | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| lint-ansible | user project | A custom [CICD-Tools script](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/boxes/bootstrap/pre-commit/lint-ansible.sh) invokes ansible-lint in [poetry](https://python-poetry.org/). | +| lint-github-workflow | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| lint-github-workflow-header | shell | A custom [CICD-Tools script](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/boxes/bootstrap/pre-commit/lint-github-workflow-header.sh) is invoked. | +| lint-markdown | 3rd party | The official [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli/pkgs/container/markdownlint-cli) container is used to invoke this tool. | +| lint-shell | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| security-credentials | 3rd Party | The official [trufflehog](https://hub.docker.com/r/trufflesecurity/trufflehog/) container is used to invoke this tool. | +| spelling-commit-message | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| spelling-markdown | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | +| spelling-vale-synchronize | CICD-Tools | The [CICD-Tools container](https://github.com/cicd-tools-org/cicd-tools/blob/main/.cicd-tools/container/Dockerfile) is used to invoke this tool. | ## License