Replies: 19 comments 18 replies
-
Why isn't this implemented yet? gitlab is already having this functionality afaik |
Beta Was this translation helpful? Give feedback.
-
Any existing workaround? Also, I see that the workflow is sometimes not triggered at all even though I have my own runner which is in idle state. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback @cj81499. I certainly agree that time zones and scheduling is tricky, so I'll make sure that this is on the backlog. |
Beta Was this translation helpful? Give feedback.
-
We are also interested in this feature. Are there any plans to implement a timezone support? |
Beta Was this translation helpful? Give feedback.
-
Just bringing up another use case that would benefit with the addition of this, in case it further helps convince the addition of this feature. For asian timezone regions, such as here in Singapore (GMT+8), a relatively simple use case of running a workflow on midnight of every 1st day of the month, is basically impossible to schedule as: 12AM here on the first day of the month would be have been basically impossible to write with cron, since, it would require writing it as 4PM of the last day of the month could be 28, 29, 30 or 31. For example: Having this would make it easy to schedule with just a |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Another really useful feature would be to be able to add random jitter like cron supports because we can run into ratelimits when we have multiple actions running at the same time. |
Beta Was this translation helpful? Give feedback.
-
As a super hacky workaround, you can schedule your workflow to run at BOTH standard and daylight times, and then use a bash script to filter out the undesirable runs. This means you'll have 2 runs for every schedule date, but only one of them will execute past the Something like this should work: on:
schedule:
- cron: "00 18,19 * * TUE" # Run every tuesday at 12:00 noon MDT (GMT-6) and MST (GMT-7)
env:
TZ: "America/Edmonton"
LOCAL_TIME: "12:00"
jobs:
test-date:
runs-on: ubuntu-latest
steps:
- name: Test schedule
if: github.event_name == 'schedule'
run: |
now=$(date +%s)
local_time=$(date -d "$LOCAL_TIME" +%s)
if [[ $now -gt $local_time && $now -lt "$((local_time + 3600))" ]]; then
echo "🌞 Passed daylight savings time check!"
else
echo "⏱ Waiting until $LOCAL_TIME."
exit 1
fi |
Beta Was this translation helpful? Give feedback.
-
I've created a Workaround like @bcowdery, but mine won't fail the run: on:
schedule:
- cron: '5 16,17 * * *'
jobs:
check-run:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.check_local_time.outputs.run }}
steps:
- name: Check local time
id: check_local_time
env:
TRIGGER: ${{ github.event_name }}
run: |
echo "Trigger: ${TRIGGER}"
if [[ ${TRIGGER} == 'schedule' ]]; then
echo "Checking daylight saving time"
if [ $(date --date='TZ="Europe/Berlin" now' +%H) -eq '18' ]; then
echo 'Time to run!'
echo "run=True" >> "$GITHUB_OUTPUT"
else
echo "It's not 18:05 local time in Europe/Berlin. Waiting for next execution..."
echo "run=False" >> "$GITHUB_OUTPUT"
fi
else
echo 'Trigger is not cron, ommiting time check!'
echo "run=True" >> "$GITHUB_OUTPUT"
fi
my-job:
runs-on: ubuntu-latest
if: needs.check-run.outputs.run == 'True'
needs: check-run Still, I would love to not use this workaround, but perhaps this is useful for anybody. |
Beta Was this translation helpful? Give feedback.
-
My team continue waiting for this feature, do you know if GitHub team already have a ticket in progress to attend it? @cj81499 @rahulmr Thanks! |
Beta Was this translation helpful? Give feedback.
-
This is a much needed feature in GH, any updates on this please. |
Beta Was this translation helpful? Give feedback.
-
any progress on this feature? thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi guys any updates on this? |
Beta Was this translation helpful? Give feedback.
-
Seems like easy to implement and would sove a lot of problem. |
Beta Was this translation helpful? Give feedback.
-
I am very interested in this feature. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure why there are so many thumbs down reactions on these comments. This feature would greatly improve usability and bring GHA in line with other cicd offerings. Can we please get any indication if this has made it onto a backlog somewhere or if this won't be implemented? Thanks! |
Beta Was this translation helpful? Give feedback.
-
also interested in this feature |
Beta Was this translation helpful? Give feedback.
-
As a quick-and-dirty workaround, I've settled on using this To run a few times during working-hours on week-days only: schedule:
# During "Central European Time" (CET): Offset from UTC: -1
- cron: '42 7,10,13,16 * 11-12,1-3 1-5'
# During "Central European Summer Time" (CEST): Offset from UTC: -2
- cron: '42 6,9,12,15 * 4-10 1-5' During winter-months, it runs on a 1-hour offset, during summer-months on a 2-hour offset. This will be technically incorrect for a few days per year. But in my case that outweighs the hassle of "having to remember to change the |
Beta Was this translation helpful? Give feedback.
-
Originally brought up at actions/runner#1423, but I don't think anyone actually started a discussion.
Among other things, the use case I have in mind is to run a workflow at 10AM local time (the start of the workday), but the best I can do currently is 15:00 UTC (9:00 CST, 10:00 CDT) or 16:00 UTC (10:00 CST, 11:00 CDT), meaning that ~half the year, it'll run at an undesirable time.
Beta Was this translation helpful? Give feedback.
All reactions