Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally run terraform CI steps only if secrets are available #8144

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/test-changed-firestore-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
test:
name: Test Firestore Integration If Changed
runs-on: ubuntu-latest
env:
run_terraform_steps: ${{ secrets.JSSDK_ACTIONS_SA_KEY != '' }}

steps:
- name: Checkout Repo
Expand All @@ -32,20 +34,23 @@ jobs:
# This makes Actions fetch all Git history so run-changed script can diff properly.
fetch-depth: 0
- uses: 'google-github-actions/auth@v0'
if: ${{ env.run_terraform_steps }}
with:
credentials_json: '${{ secrets.JSSDK_ACTIONS_SA_KEY }}'

# create composite indexes with Terraform
- name: Setup Terraform
- name: Setup Terraform
if: ${{ env.run_terraform_steps }}
uses: hashicorp/setup-terraform@v2
- name: Terraform Init
if: ${{ env.run_terraform_steps }}
run: |
cp config/ci.config.json config/project.json
cd packages/firestore
terraform init
continue-on-error: true
- name: Terraform Apply
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && env.run_terraform_steps
run: |
cd packages/firestore

Expand Down