fix(ci): replace diff --include with find-based comparison for generated files

The GNU diff in the CI container doesn't support --include flag; switch
to a find | while-read loop that diffs each matched file individually.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas SharedInbox
2026-06-07 05:17:59 +02:00
co-authored by Claude Sonnet 4.6
parent b22ca72af3
commit 80059b67e6
+5 -4
View File
@@ -511,10 +511,11 @@ func (m *Ci) CheckGenerated(ctx context.Context) (string, error) {
WithDirectory("/committed", m.checkSrc(), dagger.ContainerWithDirectoryOpts{Owner: "ci"}).
WithDirectory("/generated", fresh, dagger.ContainerWithDirectoryOpts{Owner: "ci"}).
WithExec([]string{"/bin/bash", "-c",
`if diff -rq --include='*.g.dart' --include='*.mocks.dart' /committed /generated; then ` +
`echo "Generated files are up to date."; ` +
`else echo "ERROR: Generated files are out of date — run: dart run build_runner build"; exit 1; ` +
`fi`}).
`stale=$(find /committed -name '*.g.dart' -o -name '*.mocks.dart' | ` +
`while IFS= read -r f; do rel="${f#/committed/}"; diff -q "$f" "/generated/$rel" >/dev/null 2>&1 || echo "$rel"; done); ` +
`if [ -n "$stale" ]; then ` +
`echo "ERROR: Generated files are out of date — run: dart run build_runner build"; echo "$stale"; exit 1; ` +
`else echo "Generated files are up to date."; fi`}).
Stdout(ctx)
}