Skip to content

refactor(self-routine): collapse to a single weekly cron firing all jobs#282

Merged
bedatty merged 5 commits intodevelopfrom
refactor/unified-cron
Apr 27, 2026
Merged

refactor(self-routine): collapse to a single weekly cron firing all jobs#282
bedatty merged 5 commits intodevelopfrom
refactor/unified-cron

Conversation

@bedatty
Copy link
Copy Markdown
Contributor

@bedatty bedatty commented Apr 27, 2026

Lerian

GitHub Actions Shared Workflows


Description

Each routine had its own cron expression, producing fragmented runs scattered across the Actions tab — branch cleanup at Mon 03:00, stale PRs daily at 04:00, stale issues Wed 04:30, labels sync Sun 05:00, workflow runs cleanup monthly at 06:00. Hard to skim.

Collapse to a single weekly cron — 0 3 * * 1 (Monday 03:00 UTC) — that fires the entire workflow once a week. Every job's schedule gate becomes just github.event_name == 'schedule', so all routines now run together in the same run.

Why this is fine

  • actions/stale and the cleanup composites are idempotent. Items that don't meet the threshold are listed and skipped — no side effect from running more often than strictly needed.
  • A weekly cadence for stale-pr (vs. daily) is acceptable for this repo's volume. If a faster PR cycle is needed later, add a second cron with a job-level if gating only stale_pr.
  • All other triggers are unchanged: branch_cleanup_merged still runs on every merged PR, labels_sync still runs on push to main when .github/labels.yml changes, and every job is still dispatchable individually via workflow_dispatch.routine.

Type of Change

  • feat
  • fix
  • perf
  • refactor: Internal restructuring with no behavior change
  • docs
  • ci: Changes to self-CI (workflows under .github/workflows/ that run on this repo)
  • chore
  • test
  • BREAKING CHANGE

Breaking Changes

None. Self-* file, internal-only.

Testing

  • YAML syntax validated locally
  • Triggered a real workflow run on a caller repository using @develop or the beta tag
  • Verified all existing inputs still work with default values
  • Confirmed no secrets or tokens are printed in logs
  • Checked that unrelated workflows are not affected

Caller repo / workflow run: validated via the next scheduled Monday 03:00 UTC firing — expected: a single workflow run that contains every routine job side-by-side.

Related Issues

Closes #

Summary by CodeRabbit

  • Chores
    • Consolidated maintenance workflow to a single weekly Monday schedule for more consistent runs.
    • Scheduled jobs now execute on any schedule-triggered workflow run rather than matching an exact cron string.
    • Increased capacity for scheduled maintenance runs while preserving non-schedule triggers and dry-run behavior.

Previously each routine had its own cron (Mon 03:00 for branch cleanup,
daily 04:00 for stale PRs, Wed 04:30 for stale issues, Sun 05:00 for
labels sync, monthly 1st 06:00 for workflow runs cleanup). That
produced fragmented "stale-pr ran at 04:00, then branch cleanup at
03:00 next Monday, then..." noise across the Actions tab.

Switch to a single cron — `0 3 * * 1` (Mon 03:00 UTC) — that fires the
whole workflow once a week. Every job's schedule gate is now just
`github.event_name == 'schedule'`, so all routines run together in the
same run.

Why this is fine:
- actions/stale and the cleanup composites are idempotent — items that
  don't meet the threshold are listed and skipped, no side effect.
- A weekly cadence for stale-pr (instead of daily) is acceptable for
  this volume; if a faster PR cycle is needed later, add a second cron
  with a job-level `if` gating only `stale_pr`.
- Per-routine triggers other than schedule are unchanged:
  `branch_cleanup_merged` still fires on every merged PR, `labels_sync`
  still fires on `push` to main when `.github/labels.yml` changes, and
  every job remains dispatchable individually via `workflow_dispatch`.
@bedatty bedatty requested a review from a team as a code owner April 27, 2026 12:54
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e09a12a4-9e97-492b-bef2-a9152f84fa33

📥 Commits

Reviewing files that changed from the base of the PR and between b4d2e38 and d24c9c7.

📒 Files selected for processing (1)
  • .github/workflows/self-routine.yml

Walkthrough

Replaced multiple cron triggers with a single weekly Monday schedule and removed job guards that matched exact github.event.schedule strings; jobs now run on any schedule event. Added an operations_per_run override for the stale_pr reusable workflow to increase capacity for scheduled runs.

Changes

Cohort / File(s) Summary
Workflow Schedule
​.github/workflows/self-routine.yml
Replaced multiple on.schedule cron entries with a single weekly Monday cron. Removed exact-cron if checks and now test for github.event_name == 'schedule' for schedule-triggered runs.
Stale PR override
​.github/workflows/self-routine.yml (reusable stale_pr invocation)
Added operations_per_run input override: 420 when github.event_name == 'schedule', otherwise 60. dry_run and workflow_dispatch behavior unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately describes the main change: consolidating multiple per-routine cron schedules into a single weekly cron that fires all jobs together.
Description check ✅ Passed Description covers all required template sections with substantive detail: clear problem statement, technical justification for idempotent behavior, scope of other unaffected triggers, and testing validation with specific cron expression and validation steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/unified-cron

Comment @coderabbitai help to get the list of available commands and usage tips.

@lerian-studio lerian-studio added size/XS PR changes < 50 lines workflow Changes to one or more reusable workflow files labels Apr 27, 2026
@lerian-studio
Copy link
Copy Markdown
Contributor

lerian-studio commented Apr 27, 2026

🔍 Lint Analysis

Check Files Scanned Status
YAML Lint 1 file(s) ✅ success
Action Lint 1 file(s) ✅ success
Pinned Actions 1 file(s) ✅ success
Markdown Link Check no changes ⏭️ skipped
Spelling Check 1 file(s) ✅ success
Shell Check 1 file(s) ✅ success
README Check 1 file(s) ✅ success
Composite Schema no changes ⏭️ skipped
Deployment Matrix no changes ⏭️ skipped

🔍 View full scan logs

@lerian-studio
Copy link
Copy Markdown
Contributor

lerian-studio commented Apr 27, 2026

🛡️ CodeQL Analysis Results

Languages analyzed: actions

✅ No security issues found.


🔍 View full scan logs | 🛡️ Security tab

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/self-routine.yml:
- Around line 5-10: The current workflow cron "0 3 * * 1" runs only weekly which
reduces stale-pr.yml's effective throughput because operations_per_run remains
60 (previously refreshed daily); either change the cron back to a daily schedule
(e.g., the previous cron expression) so operations_per_run resets each day, or
increase the weekly budget in this wrapper to operations_per_run × 7 (e.g., 420)
so the aggregate weekly capacity matches the prior daily behavior—update the
cron string "0 3 * * 1" or the operations_per_run value in stale-pr.yml
accordingly and ensure any related schedule entries (lines referenced around
68-73) are adjusted consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5a689a03-31f1-4a5c-b1a3-c5963c1376e3

📥 Commits

Reviewing files that changed from the base of the PR and between e3c139d and f9aa2f6.

📒 Files selected for processing (1)
  • .github/workflows/self-routine.yml

Comment thread .github/workflows/self-routine.yml
bedatty and others added 2 commits April 27, 2026 11:08
When the cron was daily, `operations_per_run: 60` (reusable default)
refreshed every 24h — effectively ~420 ops/week. Collapsing to a
single weekly cron meant the same 60-op cap applied to a full week of
backlog, so any repo with >60 candidates would have items drift past
the stale and close windows.

Override the input on schedule events to 420 in both `stale_pr` and
`stale_issue` jobs of `self-routine.yml`. The expression is conditional
so manual `workflow_dispatch` runs keep the leaner 60-op default,
which is appropriate for an interactive sanity-check.

Reusable defaults are unchanged — external consumers that drive
`stale-pr.yml` / `stale-issue.yml` directly are free to keep daily
schedules with 60 ops/run.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/self-routine.yml:
- Around line 90-93: The scheduled `stale_issue` job's operations_per_run was
changed to conditionally use 420 for scheduled runs; revert this so
`stale_issue` keeps the previous weekly budget by setting operations_per_run to
the constant 60 (i.e., remove the schedule conditional and use 60) so the
`operations_per_run` key for the `stale_issue` job remains 60; locate the
`operations_per_run` entry for the `stale_issue` workflow job and replace the
conditional expression with the literal 60.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0738c65c-13fd-410c-a8fc-c421fc265e4c

📥 Commits

Reviewing files that changed from the base of the PR and between f9aa2f6 and b4d2e38.

📒 Files selected for processing (1)
  • .github/workflows/self-routine.yml

Comment thread .github/workflows/self-routine.yml Outdated
…L rationale comments

Per CodeRabbit's correctness note on PR #282 and the no-yaml-comments
project rule, two changes:

- `stale_issue` no longer overrides `operations_per_run`. Stale issues
  were already scheduled weekly before the unified-cron refactor (the
  prior cron was `30 4 * * 3`), so the 60-op default already maps to
  weekly throughput. Bumping it to 420 would have expanded the
  scheduled mutation budget 7x without justification — stale_pr was
  the only side that needed the bump (it was daily before).
- The inline rationale comments on the `operations_per_run` lines are
  removed in line with the project's no-`# why` policy for workflow
  YAML — the rationale belongs in the commit message, not in the file.
@bedatty bedatty merged commit edea8bb into develop Apr 27, 2026
18 checks passed
@github-actions github-actions Bot deleted the refactor/unified-cron branch April 27, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS PR changes < 50 lines workflow Changes to one or more reusable workflow files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants