From 8616ea2ec90d5769f9e0d24ca4c4734180b0a5ee Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 4 Oct 2023 15:28:33 -0700 Subject: [PATCH] refine conditionals --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f039c60df..2b4a965da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: # Run data ---- - name: Run report data - if: ${{ github.ref == 'refs/heads/main' || inputs.site_target == 'dev'}} + if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.site_target == 'dev')}} working-directory: reports run: | make parameters @@ -53,11 +53,11 @@ jobs: # copy data ---- - name: Copy development report data - if: ${{ github.ref == 'refs/heads/main' || inputs.site_target == 'dev'}} + if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.site_target == 'dev')}} run: | gsutil -m rsync -r reports/outputs/ gs://test-calitp-reports-data/report_gtfs_schedule/ - name: Copy production report data - if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.site_target == 'prod'}} + if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && inputs.site_target == 'prod')}} run: | gsutil -m rsync -r gs://test-calitp-reports-data/report_gtfs_schedule/ gs://calitp-reports-data/report_gtfs_schedule/ gsutil -m rsync -r gs://calitp-reports-data/report_gtfs_schedule/ reports/outputs/ @@ -69,14 +69,14 @@ jobs: # deploy ---- - name: Deploy development to Netlify - if: ${{ github.ref == 'refs/heads/main' || inputs.site_target == 'dev'}} + if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.site_target == 'dev')}} run: | npm install netlify-cli netlify deploy --site=cal-itp-reports --dir=./website/build --alias=test env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - name: Deploy production to Netlify - if: ${{ startsWith(github.ref, 'refs/tags/' || inputs.site_target == 'prod') }} + if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && inputs.site_target == 'prod')}} run: | npm install netlify-cli netlify deploy --site=cal-itp-reports --dir=./website/build --prod