Merge pull request #25 from InputObject2/feature/ignore-changes-on-macs #50
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: Terraform Lint and Format Check | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: 1.9.0 | |
- name: Terraform Format Check | |
run: terraform fmt -check | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Validate | |
run: terraform validate | |
- name: Install TFLint | |
run: | | |
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash | |
- name: TFLint | |
run: tflint | |
- name: Install terraform-docs | |
run: | | |
curl -sL https://github.com/terraform-docs/terraform-docs/releases/download/v0.18.0/terraform-docs-v0.18.0-linux-amd64.tar.gz -o terraform-docs.tar.gz | |
mkdir -p /tmp/terraform-docs | |
tar -xzf terraform-docs.tar.gz -C /tmp/terraform-docs | |
chmod +x /tmp/terraform-docs/terraform-docs | |
sudo mv /tmp/terraform-docs/terraform-docs /usr/local/bin/ | |
- name: Generate Terraform Docs | |
run: terraform-docs markdown table --output-file README.md . | |
- name: Check for Documentation Changes | |
run: | | |
if ! git diff --exit-code README.md; then | |
echo "::error::README.md is out of date. Please run 'terraform-docs' to update the documentation." | |
exit 1 | |
fi |