chore(ci): Do not run terraform plan in PRs when there are no changes (#5964)

This commit is contained in:
Andrew Dryga
2024-07-23 09:18:49 -06:00
committed by GitHub
parent 423032cb5b
commit 50318ae1d2

View File

@@ -32,7 +32,14 @@ jobs:
working-directory: terraform
run: |
terraform fmt --check --recursive
- name: Upload Configuration
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
terraform:
- 'terraform/**'
- if: steps.changes.outputs.terraform == 'true'
name: Upload Configuration
uses: hashicorp/tfc-workflows-github/actions/upload-configuration@v1.3.0
id: plan-upload
with:
@@ -41,7 +48,8 @@ jobs:
# https://app.terraform.io/app/firezone/workspaces/staging/settings/general
directory: "./"
speculative: true
- name: Create Plan Run
- if: steps.changes.outputs.terraform == 'true'
name: Create Plan Run
uses: hashicorp/tfc-workflows-github/actions/create-run@v1.3.0
id: plan-run
env:
@@ -51,7 +59,8 @@ jobs:
configuration_version:
${{ steps.plan-upload.outputs.configuration_version_id }}
plan_only: true
- name: Get Plan Output
- if: steps.changes.outputs.terraform == 'true'
name: Get Plan Output
uses: hashicorp/tfc-workflows-github/actions/plan-output@v1.3.0
id: plan-output
with:
@@ -59,7 +68,7 @@ jobs:
- name: Update PR
uses: actions/github-script@v7
id: plan-comment
if: ${{ github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'pull_request' && steps.changes.outputs.terraform == 'true' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |