I write as an exercise the GitHub action workflow below.
name: Cron CI
Controls when the workflow will run
on:
Triggers the workflow every day minutes
schedule:
- cron: "01 10 * * 6,7"
- cron: "01 10 * * 1,2,3,4,5"
A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
This workflow contains a single job called "cron"
cron:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Run working script
if: github.event.schedule != '01 10 * * 1,2,3,4,5'
run: echo "Wake up! Grab a brush and put a little makeup"
- name: Run resting script
if: github.event.schedule != '01 10 * * 1,2,3,4,5'
run: echo "It's not time to make a change! Just relax, take it easy."
Although it seems correct to me, I receive the error log invalid cron attribute "01 10 * * 6,7"
. May you help me understand the error?
[1] https://github.com/trouchet/sappio/actions/runs/3807658008/workflow
01
), but not all do. – Kusalananda Dec 30 '22 at 16:13cron
allows either 0 or 7 for Sunday, but maybe yours doesn't. Why do you enumerate the weekdays if you want them all, anyway? – tripleee Dec 30 '22 at 20:440
digit; 2. use 0 as Sunday. Now it works. Great! – Bruno Lobo Dec 30 '22 at 22:16