Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/infra-apply.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Create and Update Infrastructure

on:
pull_request:
paths:
- infra
- .github/workflows/infra-apply.yml
push:
branches:
- main
paths:
- infra
- .github/workflows/infra-apply.yml
workflow_dispatch:
inputs:
tf-workspace:
Expand All @@ -27,7 +37,7 @@ jobs:
run: |
tofu init
tofu validate
tofu workspace select ${{ github.event.inputs.tf-workspace }}
tofu workspace select ${{ github.event.inputs.tf-workspace || 'default' }}
tofu plan -out=tfplan
- uses: cachix/install-nix-action@v31
- name: Encrypt OpenTofu plan file
Expand All @@ -47,7 +57,8 @@ jobs:
runs-on: ubuntu-latest
needs: tofu-plan
environment: infra-${{ github.event.inputs.tf-workspace }}
if: github.ref == 'refs/heads/main' # Only run apply on main branch.
# Only run apply on main branch and when it's triggered by workflow_dispatch.
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
defaults:
run:
working-directory: ./infra # Set working directory for apply job.
Expand Down