Skip to content

Commit

Permalink
Improve error communicate in amemendment checker
Browse files Browse the repository at this point in the history
  • Loading branch information
dontcallmedom committed May 13, 2024
1 parent 2da8426 commit 805ca44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/check-rec-amendment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ module.exports = async ({github, context, core}) => {
const prAmendmentSection = Object.values(amendments).find(list => list.find(a => Array.isArray(a.pr) ? a.pr.includes(context.issue.number) : a.pr === context.issue.number ));
if (!prAmendmentSection) {
core.setFailed(`Pull request ${context.issue.number} not labeled as editorial and not referenced in amendments.json`);
process.exit(2);
}
const prAmendment = prAmendmentSection.find(a => Array.isArray(a.pr) ? a.pr.includes(context.issue.number) : a.pr === context.issue.number );
if (!prAmendment.testUpdates || !prAmendment.testUpdates.length === 0) {
core.setFailed(`Pull request ${context.issue.number} declares an amendment but does not document its test status in testUpdates`);
process.exit(2);
}
const validTestUpdates = ["already-tested", "not-testable"];
if (typeof prAmendment.testUpdates === "string" && !validTestUpdates.includes(prAmendment.testUpdates)) {
core.setFailed(`Pull request ${context.issue.number} declares an invalid test status in its amendment testUpdates field`);
process.exit(2);
}
if (Array.isArray(prAmendment.testUpdates) && !prAmendment.testUpdates.every(t => t.match(/^web-platform-tests\/wpt#[0-9]+$/))) {
core.setFailed(`Pull request ${context.issue.number} declares test updates but not using the expected format to point to web-platform-tests PRs: "web-platform-tests/wpt#NNN"`);
process.exit(2);
}
};

0 comments on commit 805ca44

Please sign in to comment.