-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
The workflow schedule and tier detection logic are tightly coupled, making updates error-prone:
Current Implementation:
- Schedule times defined in
on.schedulecron expressions - Tier detection infers tier from current hour in bash script
- Any schedule change requires updating both the cron schedule AND the tier detection logic
Recent Example:
When changing from hourly/6-hourly/daily to daily/weekly schedule, we had to:
- Update cron schedules (lines 5-10)
- Update tier detection logic (lines 94-106)
- Manually ensure the hours match up
This is brittle and easy to get wrong.
Proposed Solutions
Option 1: GitHub Actions Schedule Event Metadata
Use the actual cron expression that triggered the run (if GitHub exposes this - needs research).
Option 2: Separate Schedule Workflows
Create individual workflow files per tier:
.github/workflows/update-feeds-standard.yml(daily).github/workflows/update-feeds-stale.yml(weekly)
Each workflow hard-codes its tier, eliminating detection logic entirely.
Option 3: Configuration File
Define schedule-to-tier mapping in a JSON/YAML config file that both the schedule and detection logic read from.
schedules:
- cron: '0 2 * * *'
tier: standard
description: Daily standard feeds
- cron: '0 3 * * 0'
tier: stale
description: Weekly stale feedsOption 4: Workflow Dispatch with Scheduled Triggers
Use workflow_call with inputs to make tiers explicit parameters, then call from separate scheduled workflows.
Recommendation
Option 2 (separate workflows) is probably the simplest and most maintainable:
- No magic hour-based detection
- Each workflow is self-contained and explicit
- Easy to understand which schedule runs which tier
- Can have different timeout/concurrency settings per tier
References
- Current workflow:
.github/workflows/update-feeds.yml - Tier detection logic: lines 90-108
- Schedule definition: lines 4-10