forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
48 lines (46 loc) · 1.52 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
import type { RenovateConfig } from '../../../config/types';
import { logger } from '../../../logger';
import { platform } from '../../../modules/platform';
import * as repositoryCache from '../../../util/cache/repository';
import { clearRenovateRefs } from '../../../util/git';
import { PackageFiles } from '../package-files';
import { checkReconfigureBranch } from '../reconfigure';
import { pruneStaleBranches } from './prune';
import {
runBranchSummary,
runRenovateRepoStats,
} from './repository-statistics';
// istanbul ignore next
export async function finalizeRepo(
config: RenovateConfig,
branchList: string[],
): Promise<void> {
await checkReconfigureBranch(config);
await repositoryCache.saveCache();
await pruneStaleBranches(config, branchList);
await ensureIssuesClosing();
await clearRenovateRefs();
PackageFiles.clear();
const prList = await platform.getPrList();
if (
prList?.some(
(pr) =>
pr.state === 'merged' &&
pr.title !== 'Configure Renovate' &&
pr.title !== config.onboardingPrTitle &&
pr.sourceBranch !== config.onboardingBranch,
)
) {
logger.debug('Repo is activated');
config.repoIsActivated = true;
}
runBranchSummary(config);
runRenovateRepoStats(config, prList);
}
// istanbul ignore next
function ensureIssuesClosing(): Promise<Awaited<void>[]> {
return Promise.all([
platform.ensureIssueClosing(`Action Required: Fix Renovate Configuration`),
platform.ensureIssueClosing(`Action Required: Add missing credentials`),
]);
}