From 320f6a3afa096451b355abf581f8b719005f9740 Mon Sep 17 00:00:00 2001 From: Mark Duckworth <1124037+MarkDuckworth@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:39:47 -0600 Subject: [PATCH 1/3] Attempt to conditionally run terraform steps only if secrets are available. --- .../workflows/test-changed-firestore-integration.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index 3cc14c99c55..050ea7a43f5 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -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 @@ -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 From c2f5c69823bb44c49f44ef9affac123522ebe01a Mon Sep 17 00:00:00 2001 From: Mark Duckworth <1124037+MarkDuckworth@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:45:57 -0600 Subject: [PATCH 2/3] Add fromJSON to convert env var string value to boolean. --- .../workflows/test-changed-firestore-integration.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index 050ea7a43f5..2d87e68eccd 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -33,24 +33,24 @@ jobs: with: # 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 }} + - uses: 'google-github-actions/auth@v2' + if: ${{ fromJSON(env.run_terraform_steps) }} with: credentials_json: '${{ secrets.JSSDK_ACTIONS_SA_KEY }}' # create composite indexes with Terraform - name: Setup Terraform - if: ${{ env.run_terraform_steps }} + if: ${{ fromJSON(env.run_terraform_steps) }} uses: hashicorp/setup-terraform@v2 - name: Terraform Init - if: ${{ env.run_terraform_steps }} + if: ${{ fromJSON(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' && env.run_terraform_steps + if: github.event_name == 'pull_request' && fromJSON(env.run_terraform_steps) run: | cd packages/firestore From 52cc75b97b5f24b14cd6120d33cbdf22ec494914 Mon Sep 17 00:00:00 2001 From: Mark Duckworth <1124037+MarkDuckworth@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:51:19 -0600 Subject: [PATCH 3/3] Revert version bump for google-github-actions/auth --- .github/workflows/test-changed-firestore-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-changed-firestore-integration.yml b/.github/workflows/test-changed-firestore-integration.yml index 2d87e68eccd..85e9c7e3eaa 100644 --- a/.github/workflows/test-changed-firestore-integration.yml +++ b/.github/workflows/test-changed-firestore-integration.yml @@ -33,7 +33,7 @@ jobs: with: # This makes Actions fetch all Git history so run-changed script can diff properly. fetch-depth: 0 - - uses: 'google-github-actions/auth@v2' + - uses: 'google-github-actions/auth@v0' if: ${{ fromJSON(env.run_terraform_steps) }} with: credentials_json: '${{ secrets.JSSDK_ACTIONS_SA_KEY }}'