Skip to content

Commit e486b31

Browse files
authored
Merge pull request #1058 from XMOJ-Script-dev/updateversion-edited-no-bump
Never bump the version on a PR edit
2 parents 136e268 + 6b1612c commit e486b31

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎Update/UpdateVersion.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ function extractReleaseNotes(body) {
7979
return match ? match[1].trim() : "";
8080
}
8181
var CurrentNotes = extractReleaseNotes(String(process.argv[5] || ""));
82+
// Editing a PR (including AI reviewers adding summaries on the author's behalf) must never bump the version;
83+
// it may only refresh this PR's own entry. Versions are bumped on opened/synchronize runs.
84+
if (eventAction === "edited") {
85+
if (LastPR != CurrentPR) {
86+
console.log("PR edited, but the latest version entry is not this PR's. Not bumping the version.");
87+
process.exit(0);
88+
}
89+
if (NpmVersion != LastJSVersion) {
90+
console.warn("PR edited and owns the latest entry, but package.json and XMOJ.user.js are out of sync; skipping the metadata refresh.");
91+
process.exit(0);
92+
}
93+
}
8294
if (LastJSVersion != NpmVersion) {
8395
console.warn("Assuming you manually ran npm version.");
8496
} else if (!(LastPR == CurrentPR && NpmVersion == LastJSVersion)) {

0 commit comments

Comments
 (0)