chore(ci): skip refresh-counts PR when only timestamps changed#606
Merged
chore(ci): skip refresh-counts PR when only timestamps changed#606
Conversation
The unified refresh-counts.yml workflow opens a PR every day at 06:00 UTC. When no count actually moves between runs (npm/PyPI/crates/clones/ releases/ghPackages all unchanged), the diff is just a `fetchedAt` bump from update-github-counts.mjs writing the timestamp unconditionally — and on manual-package-counts.json, just a `lastVerifiedAt` bump when the GHCR sub-step succeeds. PR #605 (2026-05-09) hit exactly this case: 1 file / +1/-1 line, only fetchedAt moved, and the PR was closed without merging because there was nothing material to capture. Same pattern would have repeated every day with no count changes. Step 3 now extracts the textual diff for both files, filters to real change lines (`^[+-][^+-]` excludes the `+++ b/`/`--- a/` headers), drops change lines that touch only `fetchedAt` or `lastVerifiedAt`, and only opens a PR if material change lines remain. The data fetch in steps 1–2 still runs unconditionally — fresh data is always pulled, HWM cursors still advance — only the noise PR is suppressed. Verified the filter regex against three synthetic diffs: - fetchedAt-only diff → no material lines → skip (correct) - npm/total change + timestamp → material lines listed → open PR (correct) - lastVerifiedAt-only diff → no material lines → skip (correct)
This was referenced May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to PR #604. The unified
refresh-counts.ymlopens a PR every day at 06:00 UTC; when no count actually moves between runs, the diff is just afetchedAtbump (update-github-counts.mjswrites the timestamp unconditionally on line 254). PR #605 today hit exactly this case — 1 file / +1/-1 line, onlyfetchedAtchanged, closed without merging because nothing material was captured.What changed
.github/workflows/refresh-counts.ymlstep 3:git diff --no-color --^[+-][^+-]excludes the+++ b/path/--- a/pathfile-header linesfetchedAtorlastVerifiedAtThe data fetch in steps 1–2 still runs unconditionally — fresh data always pulled, HWM cursors still advance, only the noise PR is suppressed.
Why filter both
fetchedAtandlastVerifiedAtinstalls-cache.jsoncarriesfetchedAt(ISO-8601 datetime, set on every successfulupdate-github-counts.mjsrun, line 254).manual-package-counts.jsoncarrieslastVerifiedAt(date-onlyYYYY-MM-DD, set whenever the GHCR sub-step succeeds, line 263). Both are pure freshness indicators — neither carries data anyone reads. Filtering both covers the no-op-refresh case for both files.Verification
Tested the filter regex against three synthetic diffs locally:
YAML re-parsed cleanly via the
yamlpackage — 5 steps, unchanged structure.Failure modes considered
fetchedAt: not possible — the timestamps are ISO datetime / date strings, no field-name contamination.totalchanges but no individual count did: not possible —cache.total = Math.max(npm + pypi + crates + releases + ghPackages + maven, cache.total)(script line 251–253). If all components are unchanged,newTotalis unchanged,totalstays at its existing value.JSON.stringifypreserves insertion order, and the script only mutates values, never reorders.Test plan
workflow_dispatchshortly after merge to confirm a no-op refresh produces the "skipping PR" log line and no PR