fix(update): version requirements updated #28
This file contains 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
name: pre-commit | |
on: | |
# push: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
TERRAFORM_DOCS_VERSION: v0.16.0 | |
TFLINT_VERSION: v0.44.1 | |
jobs: | |
collectInputs: | |
name: collect workflow inputs | |
runs-on: ubuntu-latest | |
outputs: | |
directories: ${{steps.dirs.outputs.directories}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: list of directories that contain a versions.tf | |
id: dirs | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
preCommitOnMinVersion: | |
name: pre-commit on min version | |
needs: collectInputs | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: find out min and max versions | |
id: minMax | |
uses: clowdhaus/[email protected] | |
with: | |
directory: ${{ matrix.directory }} | |
- name: pre-commit on TF ${{ steps.minMax.outputs.minVersion }} | |
# except root directory | |
if: matrix.directory != '.' | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
with: | |
terraform-version: ${{ steps.minMax.outputs.minVersion }} | |
tflint-version: ${{ env.TFLINT_VERSION }} | |
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*' | |
- name: pre-commit on TF ${{ steps.minMax.outputs.minVersion }} | |
# on root directory | |
if: matrix.directory == '.' | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
with: | |
terraform-version: ${{ steps.minMax.outputs.minVersion }} | |
tflint-version: ${{ env.TFLINT_VERSION }} | |
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)' | |
preCommitOnMaxVersion: | |
name: pre-commit on max version | |
runs-on: ubuntu-latest | |
needs: collectInputs | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: find out min and max versions | |
id: minMax | |
uses: clowdhaus/[email protected] | |
- name: pre-commit on TF ${{ steps.minMax.outputs.maxVersion }} | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
with: | |
terraform-version: ${{ steps.minMax.outputs.maxVersion }} | |
tflint-version: ${{ env.TFLINT_VERSION }} | |
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }} | |
install-hcledit: true |