From 0af7c0029e6a4e7372dabebdca19aaae31cb63fb Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Tue, 1 Feb 2022 09:39:02 -0500 Subject: [PATCH] fix(github-action): update linters and lint workflows Signed-off-by: Devin Buhl --- .github/linters/.ansible-lint | 3 ++ .github/{lint => linters}/.markdownlint.yaml | 0 .github/{lint => linters}/.prettierignore | 0 .github/{lint => linters}/.prettierrc.yaml | 0 .github/linters/.tflint.hcl | 0 .github/{lint => linters}/.yamllint.yaml | 0 .github/workflows/lint-markdown.yaml | 28 ------------- .github/workflows/lint-shell.yaml | 27 ------------- .github/workflows/lint.yaml | 42 +++++++++++--------- .taskfiles/format.yml | 8 ++-- .taskfiles/lint.yml | 6 +-- 11 files changed, 33 insertions(+), 81 deletions(-) create mode 100644 .github/linters/.ansible-lint rename .github/{lint => linters}/.markdownlint.yaml (100%) rename .github/{lint => linters}/.prettierignore (100%) rename .github/{lint => linters}/.prettierrc.yaml (100%) create mode 100644 .github/linters/.tflint.hcl rename .github/{lint => linters}/.yamllint.yaml (100%) delete mode 100644 .github/workflows/lint-markdown.yaml delete mode 100644 .github/workflows/lint-shell.yaml diff --git a/.github/linters/.ansible-lint b/.github/linters/.ansible-lint new file mode 100644 index 00000000..1a8e36ab --- /dev/null +++ b/.github/linters/.ansible-lint @@ -0,0 +1,3 @@ +# .ansible-lint +warn_list: + - unnamed-task diff --git a/.github/lint/.markdownlint.yaml b/.github/linters/.markdownlint.yaml similarity index 100% rename from .github/lint/.markdownlint.yaml rename to .github/linters/.markdownlint.yaml diff --git a/.github/lint/.prettierignore b/.github/linters/.prettierignore similarity index 100% rename from .github/lint/.prettierignore rename to .github/linters/.prettierignore diff --git a/.github/lint/.prettierrc.yaml b/.github/linters/.prettierrc.yaml similarity index 100% rename from .github/lint/.prettierrc.yaml rename to .github/linters/.prettierrc.yaml diff --git a/.github/linters/.tflint.hcl b/.github/linters/.tflint.hcl new file mode 100644 index 00000000..e69de29b diff --git a/.github/lint/.yamllint.yaml b/.github/linters/.yamllint.yaml similarity index 100% rename from .github/lint/.yamllint.yaml rename to .github/linters/.yamllint.yaml diff --git a/.github/workflows/lint-markdown.yaml b/.github/workflows/lint-markdown.yaml deleted file mode 100644 index fdfe6118..00000000 --- a/.github/workflows/lint-markdown.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: Lint Markdown files on Pull Requests - -on: # yamllint disable-line rule:truthy - pull_request: - paths: - - "**.md" - -jobs: - markdownlint: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Get changes - uses: dorny/paths-filter@v2 - id: filter - with: - list-files: shell - filters: | - markdown: - - added|modified: "**.md" - - name: Lint files - if: ${{ steps.filter.outputs.markdown == 'true' }} - uses: reviewdog/action-shellcheck@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - markdownlint_flags: "-c '.github/lint/.markdownlint.yaml' ${{ steps.filter.outputs.markdown_files }}" diff --git a/.github/workflows/lint-shell.yaml b/.github/workflows/lint-shell.yaml deleted file mode 100644 index e4a66287..00000000 --- a/.github/workflows/lint-shell.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Lint Shell scripts on Pull Requests - -on: # yamllint disable-line rule:truthy - pull_request: - paths: - - "**.sh" - -jobs: - shellcheck: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Get changes - uses: dorny/paths-filter@v2 - id: filter - with: - list-files: shell - filters: | - shell: - - added|modified: "**.sh" - - name: Lint files - if: ${{ steps.filter.outputs.shell == 'true' }} - uses: reviewdog/action-shellcheck@v1 - with: - shellcheck_flags: "${{ steps.filter.outputs.shell_files }}" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 86411d38..6f7bca3e 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,29 +1,33 @@ --- -name: Lint YAML files on Pull Requests +name: Lint on: # yamllint disable-line rule:truthy + workflow_dispatch: pull_request: - paths: - - "**.yaml" - - "**.yml" + branches: + - main + +env: + # Currently no way to detect automatically + DEFAULT_BRANCH: main jobs: - yamllint: - runs-on: ubuntu-20.04 + build: + name: Lint + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - - name: Get changes - uses: dorny/paths-filter@v2 - id: filter with: - list-files: shell - filters: | - yaml: - - added|modified: "**.yaml" - - added|modified: "**.yml" - - name: Lint files - if: ${{ steps.filter.outputs.yaml == 'true' }} - uses: reviewdog/action-yamllint@v1 - with: - yamllint_flags: "-c .github/lint/.yamllint.yaml ${{ steps.filter.outputs.yaml_files }}" + fetch-depth: 0 + - name: Lint + uses: github/super-linter/slim@v4 + env: + VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'workflow_dispatch' }} + DEFAULT_BRANCH: "${{ env.DEFAULT_BRANCH }}" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + ANSIBLE_CONFIG_FILE: .ansible-lint + MARKDOWN_CONFIG_FILE: .markdownlint.yaml + TERRAFORM_TFLINT_CONFIG_FILE: .tflint.hcl + YAML_CONFIG_FILE: .yamllint.yaml + KUBERNETES_KUBEVAL_OPTIONS: --ignore-missing-schemas diff --git a/.taskfiles/format.yml b/.taskfiles/format.yml index 0689f818..0971f27e 100644 --- a/.taskfiles/format.yml +++ b/.taskfiles/format.yml @@ -10,8 +10,8 @@ tasks: cmds: - >- prettier - --ignore-path '.github/lint/.prettierignore' - --config '.github/lint/.prettierrc.yaml' + --ignore-path '.github/linters/.prettierignore' + --config '.github/linters/.prettierrc.yaml' --list-different --ignore-unknown --parser=markdown @@ -22,9 +22,9 @@ tasks: cmds: - >- prettier - --ignore-path '.github/lint/.prettierignore' + --ignore-path '.github/linters/.prettierignore' --config - '.github/lint/.prettierrc.yaml' + '.github/linters/.prettierrc.yaml' --list-different --ignore-unknown --parser=yaml diff --git a/.taskfiles/lint.yml b/.taskfiles/lint.yml index c949d447..146dd965 100644 --- a/.taskfiles/lint.yml +++ b/.taskfiles/lint.yml @@ -10,17 +10,17 @@ tasks: markdown: desc: Lint Markdown cmds: - - markdownlint -c '.github/lint/.markdownlint.yaml' *.md **/*.md + - markdownlint -c '.github/linters/.markdownlint.yaml' *.md **/*.md ignore_errors: true yaml: desc: Lint YAML cmds: - - yamllint -c '.github/lint/.yamllint.yaml' . + - yamllint -c '.github/linters/.yamllint.yaml' . ignore_errors: true format: desc: Lint general formatting cmds: - - prettier --ignore-path '.github/lint/.prettierignore' --config '.github/lint/.prettierrc.yaml' --check . + - prettier --ignore-path '.github/linters/.prettierignore' --config '.github/linters/.prettierrc.yaml' --check . ignore_errors: true