tfvalidate per file change on PR and fmt example (#21)

This commit is contained in:
Robert Fairburn authored and GitHub committed 2025-04-01 09:51:43 -05:00
1 parent a04a23cb6c
commit 7e61bfc4be
2 files changed
+16 -8

No files matched your search

+10 -2
View File
@@ -35,9 +35,17 @@ jobs:
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Clone repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
fetch-depth: 0
- id: matrix
run: echo "value=$(find ./ -type f -name '*.tf' | awk -F/ 'BEGIN { OFS="/" } ; {$NF=""; print }' | sort -u | jq -c -s -R 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
run: |
if [[ "${{ github.event_name }}" = "pull_request" ]]; then
echo "value=$(git diff --name-only origin/${{ github.base_ref }} | awk -F/ 'BEGIN { OFS="/" }; { if ( $NF ~ "\.tf$") { $NF=""; print "./" $0 } }' | sort -u | jq -c -s -R 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
else
echo "value=$(find ./ -type f -name '*.tf' | awk -F/ 'BEGIN { OFS="/" } ; {$NF=""; print }' | sort -u | jq -c -s -R 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
fi
tfvalidate:
name: terraform validate
runs-on: ubuntu-latest