Skip to content

fix: gha syntax

fix: gha syntax #2

name: Validator Update
on:
push: # TODO: remove before merging
workflow_dispatch:
repository_dispatch:
types: [gtfs-validator-release, gtfs-validator-update-stg]
jobs:
validator-update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Authenticate to Google Cloud
id: gcloud_auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ github.event.action == 'gtfs-validator-release' && secrets.PROD_GCP_MOBILITY_FEEDS_SA_KEY || secrets.DEV_GCP_MOBILITY_FEEDS_SA_KEY }}
- name: GCloud Setup
uses: google-github-actions/setup-gcloud@v2
- name: Set environment variables
run: |
echo "ENVIRONMENT=${{ github.event.action == 'gtfs-validator-release' && vars.PROD_MOBILITY_FEEDS_ENVIRONMENT || vars.DEV_MOBILITY_FEEDS_ENVIRONMENT }}" >> $GITHUB_ENV
echo "PROJECT_ID=${{ github.event.action == 'gtfs-validator-release' && vars.PROD_MOBILITY_FEEDS_PROJECT_ID || vars.DEV_MOBILITY_FEEDS_PROJECT_ID }}" >> $GITHUB_ENV
echo "DEPLOYER_SERVICE_ACCOUNT=${{ github.event.action == 'gtfs-validator-release' && vars.PROD_MOBILITY_FEEDS_DEPLOYER_SERVICE_ACCOUNT || vars.DEV_MOBILITY_FEEDS_DEPLOYER_SERVICE_ACCOUNT }}" >> $GITHUB_ENV
- name: Create task to run cloud function
run: |
gcloud tasks create-http-task \
--queue=test-queue-2 \
--url=https://${ENVIRONMENT}-${PROJECT_ID}.cloudfunctions.net/update-validation-report \
--schedule-time=$(date -v +1M -u +%Y-%m-%dT%H:%M:%SZ) \
--oidc-service-account-email=${DEPLOYER_SERVICE_ACCOUNT}