@maggioli-rd/sr-codeowners-plugin
Version:
Maggioli Semantic Release Plugin: Codeowners
22 lines (21 loc) • 881 B
JavaScript
import SemanticReleaseError from "@semantic-release/error";
import { execa } from "execa";
import { getConfig } from "./utils.js";
export const verifyConditions = async (pluginConfig, { logger }) => {
const { excludeRegex, codeownersPath, limit, leaderboard } = getConfig(pluginConfig);
if (limit < 0) {
throw new SemanticReleaseError("limit plugin config must be a positive integer");
}
if (codeownersPath.length == 0 || codeownersPath == "") {
throw new SemanticReleaseError("codeownersPath plugin config must be a non-empty string");
}
await verifyCommand("which", ["git", "touch", "sed", "grep", "head", "sort", "echo"]);
};
const verifyCommand = async (command, args) => {
try {
await execa(command, args);
}
catch (error) {
throw new SemanticReleaseError(`${command} returned an error: ${error}`);
}
};