Running different steps on a schedule

Say you have a workflow that runs hourly, but once a day you want the workflow to run slightly differently - without duplicating the entire workflow.

Thanks to @BrightRan, here's the solution. Use the following pattern in an if: condition for a step:

github.event_name == 'schedule' && github.event.schedule == '20 17 * * *'

Longer example:

name: Fetch updated data and deploy

on:
  push:
  schedule:
    - cron: '5,35 * * * *'
    - cron: '20 17 * * *'

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
    # ...
    - name: Download existing .db files
      if: |-
        !(github.event_name == 'schedule' && github.event.schedule == '20 17 * * *')
      env:
        DATASETTE_TOKEN: ${{ secrets.DATASETTE_TOKEN }}
      run: |-
        datasette-clone https://biglocal.datasettes.com/ dbs -v --token=$DATASETTE_TOKEN

I used this here, see #11.

Created 2020-04-20T07:39:39-07:00, updated 2020-04-20T09:24:01-07:00 · History · Edit