Skip to content

Instantly share code, notes, and snippets.

@yamatt
Created September 28, 2021 12:09
Show Gist options
  • Save yamatt/f136831081245fdecf861a7274717dc8 to your computer and use it in GitHub Desktop.
Save yamatt/f136831081245fdecf861a7274717dc8 to your computer and use it in GitHub Desktop.
cron daylight saving

GitHub Actions that are scheduled to run always run as UTC+0. This means that the time that they run varies depending on the time of year if you are in an area that uses daylight savings.

The simplest solution I found is to have two different cron lines with the same command that differ depending on the month since most countries switch their daylight savings on the last weekend of the month.

This is far from completely accurate. Some countries switch at other points of the month. However it may be accurate enough for your purposes.

on:
schedule:
- cron: "0 22 * 4-10 *"
- cron: "0 23 * 1-3,11-12 *"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment