From a040786c045ddd1626e6c5ca4cdf9cf29d5b15e0 Mon Sep 17 00:00:00 2001 From: Martin Buchleitner Date: Wed, 28 Sep 2022 13:18:48 +0200 Subject: [PATCH] feat: Pre commit update (#12) * pre-commit-config * gh action on pre-commit --- .github/workflows/ci.yml | 11 +++++++++++ .pre-commit-config.yaml | 15 +++++++++++++++ CHANGELOG.md | 1 - Dockerfile | 4 +++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8a9a7f..9505e76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,17 @@ jobs: outputs: version: ${{ steps.semrel.outputs.version }} steps: + - uses: actions/checkout@v3 + - name: Check pre-commit presence + id: precommit_exists + uses: andstor/file-existence-action@v1 + with: + files: ".pre-commit-config.yaml" + - uses: actions/setup-python@v3 + if: steps.precommit_exists.outputs.files_exists == 'true' + - uses: pre-commit/action@v3.0.0 + if: steps.precommit_exists.outputs.files_exists == 'true' + - uses: go-semantic-release/action@v1 if: github.event_name != 'pull_request' id: semrel diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0c20f60 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: https://github.com/hadolint/hadolint + rev: master + hooks: + - id: hadolint-docker + stages: [commit] diff --git a/CHANGELOG.md b/CHANGELOG.md index 31f9c10..5c706d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,4 +14,3 @@ #### Chores * **ci:** commit changes from go-semantic-release (4385c5fa) - diff --git a/Dockerfile b/Dockerfile index f7f535e..c012d4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,12 +10,14 @@ FROM docker.io/mikefarah/yq:$YQ_VERSION as yq FROM docker.io/hashicorp/packer:$PACKER_VERSION +# hadolint ignore=DL3018 RUN apk add --no-cache aws-cli bash jq curl gettext ruby-dev ruby-bundler make gcc g++ libc-dev ansible musl-dev python3-dev py3-pip libffi-dev openssl-dev cargo COPY --from=yq /usr/bin/yq /usr/local/bin/yq COPY --from=mondoo /usr/local/bin/mondoo /usr/local/bin/mondoo COPY --from=tf /bin/terraform /usr/local/bin/terraform -RUN pip3 install azure-cli +# hadolint ignore=DL3013 +RUN pip3 install --no-cache-dir azure-cli ENTRYPOINT ["/bin/bash"]