something like this :
i want to trigger it only on Saturday if any Push happens on Master branch
on:
push:
branches:
- 'master'
schedule:
- cron: '0 0 * * SAT'
on:push
currently only receives path
, branch
and tag
(include corresponding -ignore
version).
See Workflow syntax for GitHub Actions
There are other alternative (but not perfect) approaches:
Add a step to perform datetime calculation (use bash
or other tools), and use if:
condition the following steps.
on:
push:
branches: [master]
name: some-name
jobs:
example:
name: Example
runs-on: ubuntu-latest
steps:
- name: Calculate date
id: date
run: |
echo "cond=$($(date +'%w') - 6)" >> $GITHUB_OUTPUT
- name: Other steps
if: fromJSON(steps.date.outputs.cond) == 0
# Do something else
# ...
However, such calculation could be hard to implement when the cron expression is too complex.
Create a new workflow and use the cron trigger to periodically enable-disable workflow using GitHub cli. But notice that GitHub Actions do have random time delay (~several minutes) for cron triggers. See Disabling and enabling a workflow for more info.