Skip to content

Commit 1ead651

Browse files
authored
Update schedule docs to include timezone (#60290)
1 parent 08be659 commit 1ead651

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

data/reusables/repositories/actions-scheduled-workflow-example.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
Use [POSIX cron syntax](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) to schedule workflows to run at specific UTC times. Scheduled workflows run on the latest commit on the default branch. The shortest interval you can run scheduled workflows is once every 5 minutes.
1+
Use [POSIX cron syntax](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) to schedule workflows to run at specific times. By default, scheduled workflows run in UTC. You can optionally specify a timezone using an [IANA timezone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for timezone-aware scheduling. Scheduled workflows run on the latest commit on the default branch. The shortest interval you can run scheduled workflows is once every 5 minutes.
2+
3+
> [!NOTE]
4+
> For schedules that set `timezone` to a time zone that observes daylight saving time (DST), during DST spring-forward transitions, scheduled workflows in skipped hours advance to the next valid time. For example, a 2:30 AM schedule advances to 3:00 AM.
25
36
{% data reusables.repositories.cron %}
47

@@ -11,6 +14,15 @@ You can use these operators in any of the five fields:
1114
| - | Range of values | `30 4-6 * * *` runs at minute 30 of the 4th, 5th, and 6th hour. |
1215
| / | Step values | `20/15 * * * *` runs every 15 minutes starting from minute 20 through 59 (minutes 20, 35, and 50). |
1316

17+
This example triggers the workflow to run at 5:30 AM in the America/New_York timezone every Monday through Friday:
18+
19+
```yaml
20+
on:
21+
schedule:
22+
- cron: '30 5 * * 1-5'
23+
timezone: "America/New_York"
24+
```
25+
1426
A single workflow can be triggered by multiple `schedule` events. Access the `schedule` event that triggered the workflow through the `github.event.schedule` context. This example triggers the workflow to run at 5:30 UTC every Monday-Thursday, and 17:30 UTC on Tuesdays and Thursdays, but skips the `Not on Monday or Wednesday` step on Monday and Wednesday.
1527

1628
```yaml

0 commit comments

Comments
 (0)