Skip to content

Commit 1345cc3

Browse files
committed
Put the IS_DISPATCH variable inline
1 parent 7b34acc commit 1345cc3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

.github/workflows/db-update.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ on:
8181
default: false
8282
type: boolean
8383

84-
# Add workflow-level vars (these are available in job `if` expressions)
85-
vars:
86-
# True when this run was triggered by a repository_dispatch or a manual workflow_dispatch
87-
IS_DISPATCH: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' }}
88-
8984
env:
9085
python_version: '3.11'
9186
liquibase_version: '4.33.0'
@@ -94,7 +89,7 @@ jobs:
9489
resolve-api-meta:
9590
name: 'Resolve API commit/version'
9691
runs-on: ubuntu-latest
97-
if: ${{ vars.IS_DISPATCH == 'true' && inputs.API_BASE_URL != '' && secrets.API_TEST_REFRESH_TOKEN != '' }}
92+
if: ${{ contains('repository_dispatch,workflow_dispatch', github.event_name) && inputs.API_BASE_URL != '' }}
9893
outputs:
9994
COMMIT_SHA: ${{ steps.resolve.outputs.COMMIT_SHA }}
10095
API_VERSION: ${{ steps.resolve.outputs.API_VERSION }}
@@ -103,6 +98,7 @@ jobs:
10398
uses: actions/checkout@v4
10499
- name: Resolve API commit/version
105100
id: resolve
101+
if: ${{ secrets.API_TEST_REFRESH_TOKEN != '' }}
106102
uses: ./.github/actions/resolve-api-meta
107103
with:
108104
api_base_url: ${{ inputs.API_BASE_URL }}
@@ -186,7 +182,7 @@ jobs:
186182
permissions: write-all
187183
runs-on: ubuntu-latest
188184
needs: [resolve-api-meta, db-schema-update]
189-
if: ${{ always() && vars.IS_DISPATCH == 'true' }}
185+
if: ${{ always() && contains('repository_dispatch,workflow_dispatch', github.event_name) }}
190186
steps:
191187
- name: Checkout code at API commit
192188
if: ${{ needs.resolve-api-meta.result == 'success' && needs.resolve-api-meta.outputs.COMMIT_SHA != '' }}
@@ -302,7 +298,7 @@ jobs:
302298

303299
update-gcp-secret:
304300
name: Update GCP Secrets
305-
if: ${{ vars.IS_DISPATCH == 'true' && !inputs.DRY_RUN }}
301+
if: ${{ contains('repository_dispatch,workflow_dispatch', github.event_name) && !inputs.DRY_RUN }}
306302
runs-on: ubuntu-latest
307303
steps:
308304
- name: Authenticate to Google Cloud
@@ -340,3 +336,4 @@ jobs:
340336
echo "Secret $SECRET_NAME does not exist in project $PROJECT_ID, creating..."
341337
echo -n "$SECRET_VALUE" | gcloud secrets create $SECRET_NAME --data-file=- --replication-policy="automatic" --project=$PROJECT_ID
342338
fi
339+

0 commit comments

Comments
 (0)