Skip to content

Distinct job for each schedule #25662

Answered by weide-zhou
mhitza asked this question in Actions
Discussion options

You must be logged in to vote

Hi @mhitza ,

Thank you for being here! If you’d like a single workflow to include multiple schedule jobs, you can add multiple ‘corn’ expression for schedule event, sample as below, you can use ‘cron: ‘*/60 * * * *’’ for hourly…etc.(doc here)

on:
  schedule:
    - cron: '*/5 * * * *' # every 5 mins
    - cron: '*/7 * * * *' # every 7 mins

For different schedule, the github has different context, for intance, 7mins schedule:

You can use if expression to conditionally skip the other jobs then.

on:
  schedule:
    - cron: '*/5 * * * *'
    - cron: '*/7 * * * *'
jobs:
  job1:
    if: contains(github.event.schedule, '*/7 * * * *')
    runs-on: [ubuntu-latest]
    steps:
      - name: respons…

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
5 participants