|
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 | | - |
89 | 84 | env: |
90 | 85 | python_version: '3.11' |
91 | 86 | liquibase_version: '4.33.0' |
|
94 | 89 | resolve-api-meta: |
95 | 90 | name: 'Resolve API commit/version' |
96 | 91 | 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 != '' }} |
98 | 93 | outputs: |
99 | 94 | COMMIT_SHA: ${{ steps.resolve.outputs.COMMIT_SHA }} |
100 | 95 | API_VERSION: ${{ steps.resolve.outputs.API_VERSION }} |
|
103 | 98 | uses: actions/checkout@v4 |
104 | 99 | - name: Resolve API commit/version |
105 | 100 | id: resolve |
| 101 | + if: ${{ secrets.API_TEST_REFRESH_TOKEN != '' }} |
106 | 102 | uses: ./.github/actions/resolve-api-meta |
107 | 103 | with: |
108 | 104 | api_base_url: ${{ inputs.API_BASE_URL }} |
@@ -186,7 +182,7 @@ jobs: |
186 | 182 | permissions: write-all |
187 | 183 | runs-on: ubuntu-latest |
188 | 184 | 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) }} |
190 | 186 | steps: |
191 | 187 | - name: Checkout code at API commit |
192 | 188 | if: ${{ needs.resolve-api-meta.result == 'success' && needs.resolve-api-meta.outputs.COMMIT_SHA != '' }} |
@@ -302,7 +298,7 @@ jobs: |
302 | 298 |
|
303 | 299 | update-gcp-secret: |
304 | 300 | 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 }} |
306 | 302 | runs-on: ubuntu-latest |
307 | 303 | steps: |
308 | 304 | - name: Authenticate to Google Cloud |
@@ -340,3 +336,4 @@ jobs: |
340 | 336 | echo "Secret $SECRET_NAME does not exist in project $PROJECT_ID, creating..." |
341 | 337 | echo -n "$SECRET_VALUE" | gcloud secrets create $SECRET_NAME --data-file=- --replication-policy="automatic" --project=$PROJECT_ID |
342 | 338 | fi |
| 339 | +
|
0 commit comments