`every 90 minutes` and `every 36 hours` compile to hourly and daily schedules

Đang mở Phù hợp với người mới
#80,646 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
80/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, go
Lĩnh vực
cli

Hướng nghiên cứu

Kiểm tra này thuộc về validateMinimumInterval trong pkg/parser/schedule_parser.go, ngay sau mức tối thiểu 5 phút hiện có. Hãy bắt đầu bằng việc đọc cách các giá trị phút và giờ được phân tích ở đó, sau đó thêm một table test trong pkg/parser bao phủ các khoảng thời gian bị từ chối và được chấp nhận được liệt kê trong issue. Hoàn thành khi mọi khoảng thời gian không phải ước số đều thất bại với thông báo nêu rõ các giá trị hợp lệ, và các khoảng thời gian ước số như every 5 minutes, every 1h và every 24h vẫn biên dịch được.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

ai-inspected

schedule: every 90 minutes and every 36 hours compile to schedules that run hourly and daily

Analysis

Minute and hour intervals that a cron step cannot express are accepted and compile without a warning to a schedule with a different cadence.

Repro, with on.schedule set to each value and gh aw compile:

schedule: compiled cron actual runs
every 90 minutes 56/90 * * * * once an hour, at :56
every 36 hours 33 */36 * * * once a day, at 00:33 UTC
every 45 minutes M/45 * * * * once or twice an hour, 45 and 15 minutes apart, depending on the scattered offset
every 7 hours 13 */7 * * * 00:13, 07:13, 14:13, 21:13, then 00:13 (a 3 hour gap)

Cron steps restart at the top of each hour (minutes) and each day (hours), so only intervals that divide 60 (minutes) or 24 (hours) repeat evenly.

docs/src/content/docs/reference/schedule-syntax.md lists the valid values (5m, 10m, 15m, 20m, 30m and 1h, 2h, 3h, 4h, 6h, 8h, 12h), and specs/fuzzy-schedule-specification.md lists every 5h (not a factor of 24) as error ERR-INTERVAL-002. validateMinimumInterval in pkg/parser/schedule_parser.go only checks the 5 minute minimum.

Expected: compilation fails with a message that names the valid intervals.

Reproducible on main at b1c6690.

Implementation plan
  1. pkg/parser/schedule_parser.go: after the 5 minute check in validateMinimumInterval, return an error when a minute interval does not divide 60 or an hour interval does not divide 24. Both the short (every 90m) and long (every 90 minutes) forms go through this function. Suggested messages: minute interval 90 is not supported: it must divide 60 evenly (e.g. 5, 10, 15, 20, 30, 60). Use a cron expression for other cadences and hour interval 36 is not supported: it must divide 24 evenly (e.g. 1, 2, 3, 4, 6, 8, 12, 24). Use 'every N days' or a cron expression for other cadences.
  2. pkg/parser: add a table test that rejects every 90 minutes, every 45m, every 120m, every 36 hours, every 5 hours, every 7h on weekdays and accepts every 5 minutes through every 60m and every 1h through every 24h.
  3. No docs change needed; the reference page already lists the valid values.
Ngôn ngữ chính
Go
Star
5.7k
Fork
635
Merge trung bình
3 giờ 43 phút
Pull request đã merge (30 ngày)
838

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/gh-aw

Tất cả issue của github/gh-aw

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.