Skip to content

Commit 8a226a2

Browse files
committed
logs(build): make it obvious what files are actually ignored
1 parent 1c79fa8 commit 8a226a2

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

bin/diff-changes.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const isIgnoredTopLevelFile = (lowercaseFilePath: string) => {
4444
type FileChange =
4545
| { impact: 'ignored' }
4646
// Only things that influence how the Actor looks - e.g. README and CHANGELOG files, schema titles, descriptions, reordering, etc. We only need to rebuild on release
47-
| { impact: 'cosmetic'; includes: 'all-actors' | ActorConfig }
47+
| { impact: 'cosmetic'; semanticallyVerified: boolean; includes: 'all-actors' | ActorConfig }
4848
// Influences how the Actor works - we need to run tests
4949
| {
5050
impact: 'functional';
@@ -59,7 +59,7 @@ const classifyFileChange = (originalFilePath: string, actorConfigs: ActorConfig[
5959
}
6060

6161
if (lowercaseFilePath.endsWith('changelog.md')) {
62-
return { impact: 'cosmetic', includes: 'all-actors' };
62+
return { impact: 'cosmetic', semanticallyVerified: false, includes: 'all-actors' };
6363
}
6464

6565
const actorFolderInfo = maybeParseActorFolder(lowercaseFilePath);
@@ -79,11 +79,11 @@ const classifyFileChange = (originalFilePath: string, actorConfigs: ActorConfig[
7979
return { impact: 'ignored' };
8080
}
8181
if (lowercaseFilePath.endsWith('readme.md')) {
82-
return { impact: 'cosmetic', includes: actorConfigChanged };
82+
return { impact: 'cosmetic', semanticallyVerified: false, includes: actorConfigChanged };
8383
}
8484
// originalFilePath must be used here (not lowercaseFilePath) — git show is case-sensitive on Linux
8585
if (lowercaseFilePath.endsWith('.json') && isCosmeticOnlyJsonSchemaChange(commits, originalFilePath)) {
86-
return { impact: 'cosmetic', includes: actorConfigChanged };
86+
return { impact: 'cosmetic', semanticallyVerified: true, includes: actorConfigChanged };
8787
}
8888

8989
return { impact: 'functional', includes: actorConfigChanged };
@@ -127,20 +127,32 @@ export const getChangedActors = ({
127127
const actorsChanged = Array.from(actorsChangedMap.values());
128128

129129
// All below here is just for logging
130+
const formatFiles = (files: string[]) => (files.length > 0 ? files.join(', ') : '<no files>');
131+
130132
const ignoredFilesChanged = filepathsChanged.filter(
131133
(file) => classifyFileChange(file, actorConfigs, commits).impact === 'ignored',
132134
);
133-
console.error(`[DIFF]: Ignored files (don't trigger test or build): ${ignoredFilesChanged.join(', ')}`);
134-
135-
const cosmeticFilesChanged = filepathsChanged.filter(
136-
(file) => classifyFileChange(file, actorConfigs, commits).impact === 'cosmetic',
135+
console.error(`[DIFF]: Ignored files (don't trigger test or build): ${formatFiles(ignoredFilesChanged)}`);
136+
137+
const cosmeticChanges = filepathsChanged
138+
.map((file) => ({ file, change: classifyFileChange(file, actorConfigs, commits) }))
139+
.filter(({ change }) => change.impact === 'cosmetic') as {
140+
file: string;
141+
change: Extract<FileChange, { impact: 'cosmetic' }>;
142+
}[];
143+
const semanticallyVerifiedFiles = cosmeticChanges.filter(({ change }) => change.semanticallyVerified).map(({ file }) => file);
144+
const inherentlyCosmeticFiles = cosmeticChanges.filter(({ change }) => !change.semanticallyVerified).map(({ file }) => file);
145+
console.error(
146+
`[DIFF]: Cosmetic-only JSON schema changes (semantically verified, only trigger release build): ${formatFiles(semanticallyVerifiedFiles)}`,
147+
);
148+
console.error(
149+
`[DIFF]: Inherently cosmetic files (README, CHANGELOG — only trigger release build): ${formatFiles(inherentlyCosmeticFiles)}`,
137150
);
138-
console.error(`[DIFF]: Cosmetic files (should only trigger release build): ${cosmeticFilesChanged.join(', ')}`);
139151

140152
const functionalFilesChanged = filepathsChanged.filter(
141153
(file) => classifyFileChange(file, actorConfigs, commits).impact === 'functional',
142154
);
143-
console.error(`[DIFF]: Functional files (trigger test & release build): ${functionalFilesChanged.join(', ')}`);
155+
console.error(`[DIFF]: Functional files (trigger test & release build): ${formatFiles(functionalFilesChanged)}`);
144156

145157
if (actorsChanged.length > 0) {
146158
const miniactors = actorsChanged.filter((config) => !config.isStandalone).map((config) => config.actorName);

0 commit comments

Comments
 (0)