Update tfvalidate.yml (#25)
This commit is contained in:
@@ -41,11 +41,17 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- id: matrix
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" = "pull_request" || "${{ github.event_name }}" = "push" ]]; then
|
||||
echo "value=$(git diff --name-status origin/${{ github.base_ref }} | awk -v gitfilestatus="D" -F$'\t' '$1 != gitfilestatus { print $2 }' | 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
|
||||
case "${{ github.event_name }}" in
|
||||
pull_request)
|
||||
echo "value=$(git diff --name-status origin/${{ github.base_ref }} | awk -v gitfilestatus="D" -F$'\t' '$1 != gitfilestatus { print $2 }' | awk -F/ 'BEGIN { OFS="/" }; { if ( $NF ~ "\.tf$") { $NF=""; print "./" $0 } }' | sort -u | jq -c -s -R 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
|
||||
;;
|
||||
push)
|
||||
echo "value=$(git diff --name-status ${{ github.ref }}~1 | awk -v gitfilestatus="D" -F$'\t' '$1 != gitfilestatus { print $2 }' | awk -F/ 'BEGIN { OFS="/" }; { if ( $NF ~ "\.tf$") { $NF=""; print "./" $0 } }' | sort -u | jq -c -s -R 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
|
||||
;;
|
||||
*)
|
||||
echo "value=$(find ./ -type f -name '*.tf' | awk -F/ 'BEGIN { OFS="/" } ; {$NF=""; print }' | sort -u | jq -c -s -R 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
|
||||
;;
|
||||
esac
|
||||
tfvalidate:
|
||||
name: terraform validate
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user