Skip to content

chore(deps): update commitlint monorepo to v18.6.1 #21

chore(deps): update commitlint monorepo to v18.6.1

chore(deps): update commitlint monorepo to v18.6.1 #21

Workflow file for this run

name: Pre-Commit
on:
pull_request:
branches:
- main
- master
env:
TERRAFORM_DOCS_VERSION: v0.16.0
jobs:
collectInputs:
name: Collect workflow inputs
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get root directories
id: dirs
uses: clowdhaus/terraform-composite-actions/directories@v1.8.3
preCommitMinVersions:
name: Min TF pre-commit
needs: collectInputs
runs-on: ubuntu-latest
strategy:
matrix:
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@v1.2.7
with:
directory: ${{ matrix.directory }}
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' }}
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
args: "terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*"
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' }}
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
args: "terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)"
preCommitMaxVersion:
name: Max TF pre-commit
runs-on: ubuntu-latest
needs: collectInputs
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Terraform min/max versions
id: minMax
uses: clowdhaus/terraform-min-max@v1.2.7
- name: Install pre-commit dependencies
shell: bash
run: |
pip install -q pre-commit
curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/${{ env.TERRAFORM_DOCS_VERSION }}/terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-$(uname)-amd64.tar.gz
sudo tar -xzf terraform-docs.tar.gz -C /usr/bin/ terraform-docs
rm terraform-docs.tar.gz 2> /dev/null
curl -L "$(curl -s https://api.github.com/repos/mvdan/sh/releases/latest | grep -o -E -m 1 "https://.+?linux_amd64")" > shfmt \
&& chmod +x shfmt && sudo mv shfmt /usr/bin/
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ steps.minMax.outputs.maxVersion }}
- name: terraform test ${{ steps.minMax.outputs.maxVersion }}
id: terraform_test
shell: bash
working-directory: tests
run: |
terraform init
terraform test
- name: Execute pre-commit ${{ steps.minMax.outputs.maxVersion }}
id: pre_commit
continue-on-error: true
shell: bash
run: pre-commit run --all-files --color always --show-diff-on-failure
- name: Commit pre-commit diff
if: ${{ steps.pre_commit.outcome == 'failure' }}
uses: stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: Update pre-commit diff
- name: Error Exit
if: ${{ steps.pre_commit.outcome == 'failure' }}
shell: bash
run: exit 1