Skip to content

[sync] Synced only the children whose source directory a push changed. - #11

Merged
SgtSwagrid merged 1 commit into
mainfrom
feature_skip_unchanged_children
Oct 28, 2026
Merged

SgtSwagrid merged 1 commit into
mainfrom
feature_skip_unchanged_children

Conversation

@SgtSwagrid

Copy link
Copy Markdown
Owner

Summary

A push to a source with several children started a sync job for every child, even when it touched nothing that child syncs from. Themis, which syncs four library directories, paid four billed minutes for every merge, most of which change none of them (about 570 billed minutes in the last month). Now a push starts a job only for the children whose source.root it changed.

Changes

  • parse-config.sh diffs the push (github.event.before..GITHUB_SHA, fetching the earlier commit into the shallow checkout) and keeps only the children with a changed file under their source directory. A child rooted at . always syncs.
  • Every child still syncs when the push changed .github/graph.json, on a run started by hand, on a push that created its branch, and when the earlier commit can't be fetched.
  • Renames are listed as a deletion plus an addition (--no-renames), so moving a file out of a directory still syncs that directory's children.
  • GitHub Graph's own sync.yml triggers on pushes to main only, and the README now recommends the same for callers: a push to any other branch starts a job that finds nothing to sync. Themis's 293 such jobs last month were all billed.
  • The README notes that a skipped sync is made up for by the next push to that directory, or by running the workflow by hand.

Testing

Ran parse-config.sh in a throwaway Actions run (since deleted) against a config with roots scripts, ./scripts/, templates, docs and the default .:

Case Children kept
Push, config untouched scripts, ./scripts/, .
Push that changed the config all
Push that created its branch all
Earlier commit unfetchable all
workflow_dispatch all
Push with no changes . only
No before given all

🤖 Generated with Claude Code

A push now starts a sync job only for the targets whose `source.root` it
touched, or for every target if it changed the configuration file. A run
started by hand, a push which created its branch, or one whose earlier
commit can't be fetched still syncs every target. The README recommends
restricting the push trigger to the branches synced from, as GitHub
Graph's own sync.yml now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SgtSwagrid

Copy link
Copy Markdown
Owner Author

Review (PR review agent)

Approved. @SgtSwagrid asked me directly to land this series. A push now syncs only the children whose source.root it changed. Every child still syncs on a manual run, on a branch's first push (an all-zero before), when the earlier commit can't be fetched, or when .github/graph.json itself changed. A root of "" or . always syncs. git diff --name-only between two commits needs only their trees, so a depth-1 fetch of before is enough. When called as a reusable workflow, github.event is the caller's, so callers like scala-config get the same behaviour. A skipped child is caught up by its next sync, as the README now says.

Note, not blocking: a child that syncs files from outside its source.root, if the configuration allows it, would be missed by a push changing only those files.

Merging.

@SgtSwagrid
SgtSwagrid merged commit 1d6244a into main Oct 28, 2026
1 check passed
@SgtSwagrid
SgtSwagrid deleted the feature_skip_unchanged_children branch October 28, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant