Skip to content

Commit abbd1f9

Browse files
ci(check-ci-skip): fix commitMessagesMetadata.forEach is not a function
Primary Changes ---------------- 1. Added condition to commitMessagesMetadata to check if commit message is array or not. Fixes #3614 Signed-off-by: bado <[email protected]>
1 parent 35f31fa commit abbd1f9

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

tools/ci-skip-for-maintainers.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ const MAINTAINERS_REGEX = new RegExp(
1515
const main = async () => {
1616
const markdownContent = readFileSync(MaintainersFile, "utf-8");
1717

18-
const args = process.argv.slice(2);
19-
const pullReqUrl = args[0];
20-
const committerLogin = args[1];
18+
//const args = process.argv.slice(2);
19+
//const pullReqUrl = args[0];
20+
//const committerLogin = args[1];
2121

2222
//Uncomment these lines and change it for local machine testing purposes:
23-
//const pullReqUrl = "https://api.github.com/repos/<username>/cactus/pulls/<number>";
24-
//const committerLogin = "<username>";
23+
const pullReqUrl = "https://api.github.com/repos/zondervancalvez/cactus/pulls/7";
24+
const committerLogin = "zondervancalvez";
2525

2626
const fetchJsonFromUrl = async (url) => {
2727
const fetchResponse = await fetch(url);
@@ -33,10 +33,14 @@ const main = async () => {
3333
pullReqUrl + "/commits",
3434
);
3535

36-
commitMessagesMetadata.forEach((commitMessageMetadata) => {
37-
// get commit message body
38-
commitMessageList.push(commitMessageMetadata["commit"]["message"]);
39-
});
36+
if (Array.isArray(commitMessagesMetadata)) {
37+
commitMessagesMetadata.forEach((commitMessageMetadata) => {
38+
// get commit message body
39+
commitMessageList.push(commitMessageMetadata["commit"]["message"]);
40+
});
41+
} else {
42+
console.error("Commit message data is empty or null");
43+
}
4044

4145
// Check if skip-ci is found in commit message
4246
const checkSkipCI = () => {

0 commit comments

Comments
 (0)