Skip to content

Commit

Permalink
Fix linitng
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Dec 18, 2023
1 parent 6a879b8 commit bb1b98f
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions .github/actions/docs-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,46 @@ description: Checks that documentation has been updated on PR
runs:
using: composite
steps:
- name: setup go
uses: actions/setup-go@v4
with:
go-version: "1.21.x"
# cache-dependency-path: tests/go.sum

- name: setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: install tools
shell: bash
run: |
go install github.com/katbyte/terrafmt@latest
go install github.com/terraform-docs/terraform-docs@latest
- name: fmt check
shell: bash
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make fmtcheck
echo "==> Fixing Terraform code with terraform fmt..."
terraform fmt -recursive
echo "==> Fixing embedded Terraform with terrafmt..."
find . | egrep ".md|.tf" | grep -v README.md | sort | while read f; do terrafmt fmt $f; done
- name: docs check
shell: bash
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make docscheck
echo "==> Generating module documentation..."
terraform-docs -c .terraform-docs.yml .
echo "==> Generating examples documentation..."
cd examples && for d in $(ls -d */); do terraform-docs $d; done
- name: check for changes
shell: bash
run: |
echo "==> Testing for changes to tracked files"
CHANGES=$(git status -suno)
if [ "$CHANGES" ]; then
echo "Repository formatting or documentation is not correct."
echo
git diff
echo
echo "Run 'make fmt && make docs' locally and commit the changes to fix."
exit 1
fi

0 comments on commit bb1b98f

Please sign in to comment.