Skip to content

Commit 2457c0a

Browse files
committed
feat(changelog): explicitly fail when there is no reportable change
1 parent 3def312 commit 2457c0a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/changelog.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ async function main() {
145145
others,
146146
} = diffTypes(previous, current);
147147

148-
const output = [writeAddedRemoved(added, removed)];
148+
const outputs = [writeAddedRemoved(added, removed)];
149149
if (modified.size) {
150150
const modifiedOutput = [`## Modified\n`];
151151
for (const [key, value] of modified.entries()) {
152152
modifiedOutput.push(`* ${key}`);
153153
modifiedOutput.push(writeAddedRemovedInline(value.added, value.removed));
154154
}
155-
output.push(modifiedOutput.join("\n"));
155+
outputs.push(modifiedOutput.join("\n"));
156156
}
157157

158158
if (others.modified.size) {
@@ -161,9 +161,15 @@ async function main() {
161161
modifiedOutput.push(`* ${key}`);
162162
modifiedOutput.push(writeAddedRemovedInline(value.added, value.removed));
163163
}
164-
output.push(modifiedOutput.join("\n"));
164+
outputs.push(modifiedOutput.join("\n"));
165+
}
166+
167+
const output = outputs.join("\n\n");
168+
if (output.length) {
169+
console.log(output);
170+
} else {
171+
throw new Error(`No change reported between ${base} and ${head}.`);
165172
}
166-
console.log(output.join("\n\n"));
167173
}
168174

169175
await main();

0 commit comments

Comments
 (0)