Repository navigation
refactor: move repository into a terraform module #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Terraform Test | |
| on: | |
| push: | |
| branches: ['**'] | |
| tags-ignore: ['**'] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| gate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run: ${{ steps.check.outputs.run }} | |
| steps: | |
| - id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| run=true | |
| if [ "$GITHUB_EVENT_NAME" = push ] && [ "$GITHUB_REF_NAME" != main ] \ | |
| && [ "$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" \ | |
| --jq '[.[] | select(.state == "open")] | length')" -gt 0 ]; then | |
| run=false | |
| fi | |
| echo "run=$run" >>"$GITHUB_OUTPUT" | |
| test: | |
| name: Terraform Test | |
| needs: gate | |
| if: needs.gate.outputs.run == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Terraform | |
| uses: hashicorp/setup-terraform@v4 | |
| - name: Terraform fmt | |
| run: terraform -chdir=terraform fmt -check -recursive | |
| - name: Terraform init | |
| run: terraform -chdir=terraform init -backend=false | |
| - name: Terraform test | |
| run: terraform -chdir=terraform test |