定期実行の Cron 式で分岐が可能
以下のように、 on.event.schedule
で分岐できるとのこと。
on:
schedule:
- cron: '30 5 * * 1,3'
- cron: '30 5 * * 2,4'
jobs:
test_schedule:
runs-on: ubuntu-latest
steps:
- name: Not on Monday or Wednesday
if: github.event.schedule != '30 5 * * 1,3'
run: echo "This step will be skipped on Monday and Wednesday"
- name: Every time
run: echo "This step will always run"
cron 式の時刻は UTC なので、忘れずに。
schedule は遅れる可能性がある
当たり前だが、負荷によって遅延の可能性はある。 hosted でなければ自分たちのリポジトリだけでなく他のリポジトリの action の影響を受けるため、より近い時間に実行したいならは負荷をコントロールできる環境で実行する必要がある。