Skip to content

Commit 0068ed5

Browse files
Conditionally run terraform CI steps only if secrets are available. (#8144)
1 parent a6fa544 commit 0068ed5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/test-changed-firestore-integration.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
test:
2525
name: Test Firestore Integration If Changed
2626
runs-on: ubuntu-latest
27+
env:
28+
run_terraform_steps: ${{ secrets.JSSDK_ACTIONS_SA_KEY != '' }}
2729

2830
steps:
2931
- name: Checkout Repo
@@ -32,20 +34,23 @@ jobs:
3234
# This makes Actions fetch all Git history so run-changed script can diff properly.
3335
fetch-depth: 0
3436
- uses: 'google-github-actions/auth@v0'
37+
if: ${{ env.run_terraform_steps }}
3538
with:
3639
credentials_json: '${{ secrets.JSSDK_ACTIONS_SA_KEY }}'
37-
40+
3841
# create composite indexes with Terraform
39-
- name: Setup Terraform
42+
- name: Setup Terraform
43+
if: ${{ env.run_terraform_steps }}
4044
uses: hashicorp/setup-terraform@v2
4145
- name: Terraform Init
46+
if: ${{ env.run_terraform_steps }}
4247
run: |
4348
cp config/ci.config.json config/project.json
4449
cd packages/firestore
4550
terraform init
4651
continue-on-error: true
4752
- name: Terraform Apply
48-
if: github.event_name == 'pull_request'
53+
if: github.event_name == 'pull_request' && env.run_terraform_steps
4954
run: |
5055
cd packages/firestore
5156

0 commit comments

Comments
 (0)