Files
panxiao81 3871d34232
yaml / yaml (pull_request) Failing after 3s
ansible / lint (pull_request) Failing after 4s
terraform / validate (pull_request) Failing after 4s
ansible / collection-test (pull_request) Failing after 4s
ci: 统一使用 pod runner
2026-09-16 16:33:16 +00:00

36 lines
919 B
YAML

---
name: terraform
on:
push:
branches: [main]
paths:
- '**/*.tf'
- '**/.terraform.lock.hcl'
- '.gitea/workflows/terraform.yml'
pull_request:
paths:
- '**/*.tf'
- '**/.terraform.lock.hcl'
- '.gitea/workflows/terraform.yml'
jobs:
validate:
runs-on: [self-hosted, pod]
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: fmt and validate
# -backend=false so validate never touches real state or needs credentials.
run: |
rc=0
for d in $(git ls-files '*.tf' | xargs -n1 dirname | sort -u); do
echo "::group::$d"
terraform -chdir="$d" fmt -check -diff || rc=1
terraform -chdir="$d" init -backend=false -input=false || rc=1
terraform -chdir="$d" validate || rc=1
echo "::endgroup::"
done
exit $rc