import { GlobalConfig } from "../../../../config/global.js";
import { logger } from "../../../../logger/index.js";
import { platform } from "../../../../modules/platform/index.js";

//#region lib/workers/repository/update/branch/artifacts.ts
async function setArtifactErrorStatus(config) {
	if (!config.artifactErrors?.length) return;
	const context = config.statusCheckNames?.artifactError;
	if (!context) {
		logger.debug("Status check is null or an empty string, skipping status check addition.");
		return;
	}
	const description = "Artifact file update failure";
	const state = "red";
	if (await platform.getBranchStatusCheck(config.branchName, context) !== state) {
		logger.debug(`Updating status check state to failed`);
		if (GlobalConfig.get("dryRun")) logger.info("DRY-RUN: Would set branch status in " + config.branchName);
		else await platform.setBranchStatus({
			branchName: config.branchName,
			context,
			description,
			state
		});
	}
}

//#endregion
export { setArtifactErrorStatus };
//# sourceMappingURL=artifacts.js.map