|
81 | 81 | default: false |
82 | 82 | type: boolean |
83 | 83 |
|
| 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 | + |
84 | 89 | env: |
85 | 90 | python_version: '3.11' |
86 | 91 | liquibase_version: '4.33.0' |
87 | | - # True when this run was triggered by a repository_dispatch or a manual workflow_dispatch |
88 | | - IS_DISPATCH: ${{ github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' }} |
89 | 92 |
|
90 | 93 | jobs: |
91 | 94 | resolve-api-meta: |
92 | 95 | name: 'Resolve API commit/version' |
93 | 96 | runs-on: ubuntu-latest |
94 | | - if: ${{ env.IS_DISPATCH == 'true' && inputs.API_BASE_URL != '' && secrets.API_TEST_REFRESH_TOKEN != '' }} |
| 97 | + if: ${{ vars.IS_DISPATCH == 'true' && inputs.API_BASE_URL != '' && secrets.API_TEST_REFRESH_TOKEN != '' }} |
95 | 98 | outputs: |
96 | 99 | COMMIT_SHA: ${{ steps.resolve.outputs.COMMIT_SHA }} |
97 | 100 | API_VERSION: ${{ steps.resolve.outputs.API_VERSION }} |
@@ -183,7 +186,7 @@ jobs: |
183 | 186 | permissions: write-all |
184 | 187 | runs-on: ubuntu-latest |
185 | 188 | needs: [resolve-api-meta, db-schema-update] |
186 | | - if: ${{ always() && env.IS_DISPATCH == 'true' }} |
| 189 | + if: ${{ always() && vars.IS_DISPATCH == 'true' }} |
187 | 190 | steps: |
188 | 191 | - name: Checkout code at API commit |
189 | 192 | if: ${{ needs.resolve-api-meta.result == 'success' && needs.resolve-api-meta.outputs.COMMIT_SHA != '' }} |
@@ -299,7 +302,7 @@ jobs: |
299 | 302 |
|
300 | 303 | update-gcp-secret: |
301 | 304 | name: Update GCP Secrets |
302 | | - if: ${{ env.IS_DISPATCH == 'true' && !inputs.DRY_RUN }} |
| 305 | + if: ${{ vars.IS_DISPATCH == 'true' && !inputs.DRY_RUN }} |
303 | 306 | runs-on: ubuntu-latest |
304 | 307 | steps: |
305 | 308 | - name: Authenticate to Google Cloud |
@@ -337,4 +340,3 @@ jobs: |
337 | 340 | echo "Secret $SECRET_NAME does not exist in project $PROJECT_ID, creating..." |
338 | 341 | echo -n "$SECRET_VALUE" | gcloud secrets create $SECRET_NAME --data-file=- --replication-policy="automatic" --project=$PROJECT_ID |
339 | 342 | fi |
340 | | -
|
|
0 commit comments