Skip to content

fix: Allow mono to publish to this repo #2223

fix: Allow mono to publish to this repo

fix: Allow mono to publish to this repo #2223

Workflow file for this run

name: Validate terraform
on:
pull_request:
branches:
- 'main'
permissions: {}
jobs:
build-matrix:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: "${{steps.list_dirs.outputs.matrix}}"
steps:
- name: Harden Runner
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: List tf dirs
id: list_dirs
run: |
# list all files with *.tf files, take the dirname, and dedupe with sort -u
matrix="$(find . -type f -name "*.tf" -exec dirname "{}" \; | sort -u | jq -cnR '[inputs | select(length>0)]')"
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
validate:
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- build-matrix
strategy:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#defining-the-maximum-number-of-concurrent-jobs
max-parallel: 10
fail-fast: false
matrix:
dirs: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- uses: chainguard-dev/actions/setup-terraform@3e8a2a226fad9e1ecbf2d359b8a7697554a4ac6d # v1.5.10
with:
terraform-version-file: './.terraform-version'
terraform-wrapper: false
- working-directory: ${{ matrix.dirs }}
run: |
terraform init
terraform validate
conclusion:
permissions:
actions: read
needs: validate
runs-on: ubuntu-latest
if: always()
steps:
- name: Harden Runner
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- uses: step-security/workflow-conclusion-action@e624ac1e0582b6498a4ddaa8cf623532fc7b95ea # v3.0.9
- if: ${{ env.WORKFLOW_CONCLUSION == 'success' }}
working-directory: /tmp
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0
- if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }}
working-directory: /tmp
run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 1