Files
Dan Moseley 492ab1d174 Reduce scheduled evaluation from every 3h to daily (#362)
* Reduce scheduled evaluation from every 3h to daily, skip if no changes

The evaluation schedule was consuming ~/5 days in Copilot premium
requests from scheduled runs alone (~/month pace). This change:

1. Reduces the cron schedule from every 3 hours (8 runs/day) to once
   daily at 08:00 UTC. This alone saves ~87% of scheduled evaluation
   cost.

2. Adds a check-for-changes guard that skips the scheduled run entirely
   if there have been no new commits to main since the last successful
   scheduled evaluation. This avoids wasting tokens re-evaluating
   identical code.

The PR trigger and all PR evaluation behavior is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback: harden skip-if-no-changes guard

- Add actions: read permission so the workflow run lookup succeeds
- Use status=completed with jq conclusion filter instead of status=success
- Make all gh api calls non-fatal (fallback to has_changes=true on error)
- Make compare API call best-effort for logging only

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Scope actions:read to discover job, increase per_page to 100

- Move actions:read from workflow-level to discover job permissions
  for least-privilege (only the schedule guard needs it)
- Increase per_page from 10 to 100 so the skip guard finds the last
  successful run even after long failure streaks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Key skip guard off most recent completed run, not just successful

Only skip when the most recent completed scheduled run was successful
AND at the same SHA. If it failed/cancelled at the current SHA, proceed
to retry. This prevents the guard from skipping indefinitely after a
transient failure.

Also simplifies to per_page=1 since we only inspect the latest run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix jq filter to yield empty when no prior runs exist

Use // empty to guard against null when workflow_runs array is empty,
preventing 'null null' from leaking into LAST_SHA/LAST_CONCLUSION.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Bypass skip guard on manual reruns (run_attempt > 1)

When a maintainer clicks 'Re-run jobs' on a scheduled run, the event
is still schedule with the same SHA. Without this check, the guard
would skip the rerun if the previous attempt succeeded. Now reruns
always proceed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-14 02:24:47 +00:00
..
2026-03-11 15:06:04 -07:00