Skip to content

Commit 380a331

Browse files
refactor: move utility fn (renovatebot#35478)
1 parent 5fb89cd commit 380a331

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
import is from '@sindresorhus/is';
2+
import { platform } from '../../../modules/platform';
3+
import type { BranchStatus } from '../../../types';
4+
15
export function getReconfigureBranchName(prefix: string): string {
26
return `${prefix}reconfigure`;
37
}
8+
9+
export async function setBranchStatus(
10+
branchName: string,
11+
description: string,
12+
state: BranchStatus,
13+
context?: string | null,
14+
): Promise<void> {
15+
if (!is.nonEmptyString(context)) {
16+
// already logged this case when validating the status check
17+
return;
18+
}
19+
20+
await platform.setBranchStatus({
21+
branchName,
22+
context,
23+
description,
24+
state,
25+
});
26+
}

lib/workers/repository/reconfigure/validate.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,13 @@ import { logger } from '../../../logger';
77
import { platform } from '../../../modules/platform';
88
import { ensureComment } from '../../../modules/platform/comment';
99
import { scm } from '../../../modules/platform/scm';
10-
import type { BranchStatus } from '../../../types';
1110
import { getCache } from '../../../util/cache/repository';
1211
import { readLocalFile } from '../../../util/fs';
1312
import { getBranchCommit } from '../../../util/git';
1413
import { regEx } from '../../../util/regex';
1514
import { detectConfigFile } from '../init/merge';
1615
import { setReconfigureBranchCache } from './reconfigure-cache';
17-
import { getReconfigureBranchName } from './utils';
18-
19-
async function setBranchStatus(
20-
branchName: string,
21-
description: string,
22-
state: BranchStatus,
23-
context?: string | null,
24-
): Promise<void> {
25-
if (!is.nonEmptyString(context)) {
26-
// already logged this case when validating the status check
27-
return;
28-
}
29-
30-
await platform.setBranchStatus({
31-
branchName,
32-
context,
33-
description,
34-
state,
35-
});
36-
}
16+
import { getReconfigureBranchName, setBranchStatus } from './utils';
3717

3818
export async function validateReconfigureBranch(
3919
config: RenovateConfig,

0 commit comments

Comments
 (0)