Skip to content

octo-sts-secret: New terraform module for rotating GitHub tokens #574

octo-sts-secret: New terraform module for rotating GitHub tokens

octo-sts-secret: New terraform module for rotating GitHub tokens #574

Workflow file for this run

name: Validate terraform
on:
pull_request:
branches: [ 'main' ]
permissions:
contents: read
jobs:
build-matrix:
runs-on: ubuntu-latest
outputs:
matrix: "${{steps.list_dirs.outputs.matrix}}"
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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
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@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
- 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@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3
- 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