Skip to content

Commit 6f193b3

Browse files
committed
addressed Copilot feedback
1 parent e18f840 commit 6f193b3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/merge-approved-pr.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ jobs:
202202
return;
203203
}
204204
205+
const oldVersion = `${oldMatch[1]}.${oldMatch[2]}.${oldMatch[3]}`;
206+
const newVersion = `${newMatch[1]}.${newMatch[2]}.${newMatch[3]}`;
207+
if (oldVersion === newVersion) {
208+
core.setFailed('Validation failed: package.json version must change (format-only edits are not allowed).');
209+
return;
210+
}
211+
205212
const [oldMajor, oldMinor, oldPatch] = oldMatch.slice(1).map((n) => Number(n));
206213
const [newMajor, newMinor, newPatch] = newMatch.slice(1).map((n) => Number(n));
207214
@@ -211,10 +218,9 @@ jobs:
211218
212219
if (isMajorBump || isMinorBump || isPatchBump) {
213220
console.log(
214-
`The only change is in package.json, and the only line changed is 'version' with a valid semver bump (${oldMatch[1]}.${oldMatch[2]}.${oldMatch[3]} -> ${newMatch[1]}.${newMatch[2]}.${newMatch[3]}).`,
221+
`The only change is in package.json, and the only line changed is 'version' with a valid semver bump (${oldVersion} -> ${newVersion}).`,
215222
);
216-
}
217-
else {
223+
} else {
218224
core.setFailed('Validation failed: version must bump by exactly +1 major (reset to .0.0), +1 minor (reset patch to .0), or +1 patch.');
219225
}
220226

0 commit comments

Comments
 (0)