I want to trigger my UI tests on every 3rd Saturday of every month so that the application is tested after code is moved.
This is my current trigger:
on:
schedule:
- cron: '00 00 * * 6'
I want to trigger my UI tests on every 3rd Saturday of every month so that the application is tested after code is moved.
This is my current trigger:
on:
schedule:
- cron: '00 00 * * 6'
Your question is about the schedule
event in the POSIX cron syntax which can only express every weekday:
on: schedule: - cron: '22 2 * * 6' # At 02:22, only on Saturday
As it runs every Saturday, it will run on every third Saturday as well.
If you can live with that, you can consider your question answered.
However, as a Posix cron expression does not support to specify the n-th Weekday in a month, it is common then to not execute the job if it is not the correct day. Within the crontab this could be with the command itself1, an option that is also available with a cron
expression for a Microsoft Github Action Trigger, same same but different:
With jobs.<job_id>.if
Expressions it is possible to formulate whether or not your job is being run.
As no date expressions exist for it but it can operate on the output of a previous job2, a previous job can take care of the shell expression for the third Saturday (if, and only if, it runs on a Saturday):
- name: Get number of Saturday on a Saturday
id: number-of-saturday-on-a-saturday
run: >-
printf >> "$GITHUB_OUTPUT"
"VALUE=%s"
"$((($(date +%d)-1)/7+1))" # (3)
- name: Test Foo
run: foo test
if: steps.number-of-saturday-on-a-saturday.outputs.VALUE == 3