/
artifacts.ts
37 lines (34 loc) · 1 KB
/
artifacts.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { getGlobalConfig } from '../../config/global';
import { logger } from '../../logger';
import { platform } from '../../platform';
import { BranchStatus } from '../../types';
import type { BranchConfig } from '../types';
export async function setArtifactErrorStatus(
config: BranchConfig
): Promise<void> {
if (!config.artifactErrors?.length) {
// no errors
return;
}
const context = `renovate/artifacts`;
const description = 'Artifact file update failure';
const state = BranchStatus.red;
const existingState = await platform.getBranchStatusCheck(
config.branchName,
context
);
// Check if state needs setting
if (existingState !== state) {
logger.debug(`Updating status check state to failed`);
if (getGlobalConfig().dryRun) {
logger.info('DRY-RUN: Would set branch status in ' + config.branchName);
} else {
await platform.setBranchStatus({
branchName: config.branchName,
context,
description,
state,
});
}
}
}