Skip to content

Schedule once an hour, but do something different once a day? #26814

Answered by BrightRan
simonw asked this question in Actions
Discussion options

You must be logged in to vote

@simonw ,

You can try the following configurations in your workflow:

on:
  schedule:
    - cron: '0 1-23 * * *'
    - cron: '0 0 * * *'

jobs:
test_schedule:
name: Test schedule
runs-on: ubuntu-latest
steps:
- name: Skip this step every 24 hours
if: github.event_name == 'schedule' && github.event.schedule != '0 0 * * *'
run: echo "This step will be skipped every 24 hours"

1) The first cron ’ 0 1-23 * * *’ will trigger the workflow hourly from the 1st hour to 23th hour.

2) The second cron ’ 0 0 * * *’ will only trigger the workflow at 00:00 UTC.

3) The property " github.event.schedule" of the github context returns the cron of the schedule that triggers the current workflow run.

4) On the …

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants