chore(dev-tools): update tflint (non-major) #2073
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # yamllint disable rule:line-length | |
| name: lint | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| detect-changes: | |
| outputs: | |
| actions_any_changed: ${{ steps.changed-files-yaml.outputs.actions_any_changed }} | |
| actions_all_changed_files: ${{ steps.changed-files-yaml.outputs.actions_all_changed_files}} | |
| docker_any_changed: ${{ steps.changed-files-yaml.outputs.docker_any_changed }} | |
| docker_all_changed_files: ${{ steps.changed-files-yaml.outputs.docker_all_changed_files}} | |
| renovate_any_changed: ${{ steps.changed-files-yaml.outputs.renovate_any_changed }} | |
| renovate_all_changed_files: ${{ steps.changed-files-yaml.outputs.renovate_all_changed_files}} | |
| shellscripts_any_changed: ${{ steps.changed-files-yaml.outputs.shellscripts_any_changed }} | |
| shellscripts_all_changed_files: ${{ steps.changed-files-yaml.outputs.shellscripts_all_changed_files}} | |
| terraform_any_changed: ${{ steps.changed-files-yaml.outputs.terraform_any_changed }} | |
| terraform_all_changed_files: ${{ steps.changed-files-yaml.outputs.terraform_all_changed_files}} | |
| terraform_dirs: ${{ steps.determine-tf-dirs.outputs.dirs }} | |
| yaml_any_changed: ${{ steps.changed-files-yaml.outputs.yaml_any_changed }} | |
| yaml_all_changed_files: ${{ steps.changed-files-yaml.outputs.yaml_all_changed_files}} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Determine what files types have changed | |
| id: changed-files-yaml | |
| uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45 | |
| with: | |
| files_yaml: | | |
| actions: | |
| - .github/workflows/** | |
| docker: | |
| - '**/Dockerfile' | |
| renovate: | |
| - .github/renovate.json | |
| - .github/renovate/** | |
| shellscripts: | |
| - '**.sh' | |
| terraform: | |
| - '**.tf' | |
| - '**/.terraform-version' | |
| - '**/.terraform.lock.hcl' | |
| - '.tflint.hcl' | |
| yaml: | |
| - '**.yaml' | |
| - name: Determine Terraform directories to validate | |
| id: determine-tf-dirs | |
| # yamllint disable-line rule:indentation | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| # For workflow_dispatch, validate all terraform directories | |
| TF_DIRS=$(find templates/ -maxdepth 2 -mindepth 2 -type d -not -name '.*' 2>/dev/null | sort | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| elif [[ "${{ steps.changed-files-yaml.outputs.terraform_any_changed }}" == "true" ]]; then | |
| # For pull requests, check which files changed | |
| CHANGED_FILES="${{ steps.changed-files-yaml.outputs.terraform_all_changed_files }}" | |
| TEMPLATE_CHANGES=$(echo "$CHANGED_FILES" | tr ' ' '\n' | grep '^templates/' || true) | |
| # Otherwise only validate affected templates | |
| TF_DIRS=$(echo "$TEMPLATE_CHANGES" | grep -o 'templates/[^/]*' | sort | uniq | tr -d ' ' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| else | |
| TF_DIRS="[]" | |
| echo "No Terraform changes detected" | |
| fi | |
| echo "dirs=$TF_DIRS" >> $GITHUB_OUTPUT | |
| commit-messages: | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-commit-messages.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref }} | |
| fetch_depth: ${{ github.event.pull_request.commits }} | |
| from: ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} | |
| to: ${{ github.event.pull_request.head.sha }} | |
| github-actions: | |
| needs: [detect-changes] | |
| if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.actions_any_changed == 'true' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-github-actions.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| files: ${{ github.event_name == 'workflow_dispatch' && 'ALL' || needs.detect-changes.outputs.actions_all_changed_files }} | |
| docker-files: | |
| needs: [detect-changes] | |
| if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.docker_any_changed == 'true' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-hadolint.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| files: ${{ github.event_name == 'workflow_dispatch' && 'ALL' || needs.detect-changes.outputs.docker_all_changed_files }} | |
| pre-commit: | |
| uses: ppat/github-workflows/.github/workflows/lint-pre-commit.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| renovate-config-check: | |
| needs: [detect-changes] | |
| if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.renovate_any_changed == 'true' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-renovate-config-check.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| files: ${{ github.event_name == 'workflow_dispatch' && 'ALL' || needs.detect-changes.outputs.renovate_all_changed_files }} | |
| shellcheck: | |
| needs: [detect-changes] | |
| if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.shellscripts_any_changed == 'true' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-shellcheck.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| files: ${{ github.event_name == 'workflow_dispatch' && 'ALL' || needs.detect-changes.outputs.shellscripts_all_changed_files }} | |
| terraform: | |
| needs: [detect-changes] | |
| if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.terraform_any_changed == 'true' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-terraform.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| tf_dirs: ${{ needs.detect-changes.outputs.terraform_dirs }} | |
| yaml: | |
| needs: [detect-changes] | |
| if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.yaml_any_changed == 'true' }} | |
| uses: ppat/github-workflows/.github/workflows/lint-yaml.yaml@main | |
| with: | |
| git_ref: ${{ github.head_ref || github.ref }} | |
| files: ${{ github.event_name == 'workflow_dispatch' && 'ALL' || needs.detect-changes.outputs.yaml_all_changed_files }} |