Skip to content

Commit

Permalink
ci(check-ci-skip): fix commitMessagesMetadata.forEach is not a function
Browse files Browse the repository at this point in the history
Primary Changes
----------------
1. Added condition to commitMessagesMetadata
to check if commit message is array or not.

Fixes #3614

Signed-off-by: bado <[email protected]>
  • Loading branch information
zondervancalvez committed Nov 5, 2024
1 parent 35f31fa commit 0c47b08
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tools/ci-skip-for-maintainers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const MAINTAINERS_REGEX = new RegExp(
const main = async () => {
const markdownContent = readFileSync(MaintainersFile, "utf-8");

const args = process.argv.slice(2);
const pullReqUrl = args[0];
const committerLogin = args[1];
//const args = process.argv.slice(2);
//const pullReqUrl = args[0];
//const committerLogin = args[1];

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

const fetchJsonFromUrl = async (url) => {
const fetchResponse = await fetch(url);
Expand All @@ -33,10 +33,14 @@ const main = async () => {
pullReqUrl + "/commits",
);

commitMessagesMetadata.forEach((commitMessageMetadata) => {
// get commit message body
commitMessageList.push(commitMessageMetadata["commit"]["message"]);
});
if (Array.isArray(commitMessagesMetadata)) {
commitMessagesMetadata.forEach((commitMessageMetadata) => {
// get commit message body
commitMessageList.push(commitMessageMetadata["commit"]["message"]);
});
} else {
console.error("Commit message data is empty or null");
}

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

0 comments on commit 0c47b08

Please sign in to comment.