Skip to content

Commit

Permalink
fix: run plan on change
Browse files Browse the repository at this point in the history
  • Loading branch information
tericcabrel committed Aug 3, 2024
1 parent 99b6d11 commit 41df39b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/infra-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,25 @@ jobs:
#- 'apps/backend/_infra/prod/storage'
- 'apps/backend/_infra/prod/compute'

outputs:
infraChanged: ${{ steps.infra-changed.outputs.any_changed }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check if infra files changed
id: infra-changed
uses: tj-actions/changed-files@v44
with:
files: |
${{ matrix.directory }}/**/*.tf
- name: Setup Terraform
if: ${{ steps.infra-changed.outputs.any_changed == 'true' }}
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.3.0 # Specify your Terraform version
terraform_version: 1.9.2

- name: Upload Configuration
uses: hashicorp/tfc-workflows-github/actions/[email protected]
Expand Down Expand Up @@ -63,7 +74,6 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// 1. Retrieve existing bot comments for the PR
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -78,7 +88,6 @@ jobs:
\`\`\`
[View changes in detail](${{ steps.plan-run.outputs.run_link }})
`;
// 3. Delete previous comment so PR timeline makes sense
if (botComment) {
github.rest.issues.deleteComment({
owner: context.repo.owner,
Expand Down

0 comments on commit 41df39b

Please sign in to comment.