renovate 44.168.1 → 44.168.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/platform/azure/index.js +7 -1
- package/dist/modules/platform/azure/index.js.map +1 -1
- package/dist/modules/platform/index.d.ts +2 -2
- package/dist/modules/platform/types.d.ts +6 -0
- package/dist/workers/repository/init/index.js +1 -0
- package/dist/workers/repository/init/index.js.map +1 -1
- package/package.json +2 -2
- package/renovate-schema.json +2 -2
|
@@ -28,6 +28,7 @@ import { PolicyEvaluationStatus } from "azure-devops-node-api/interfaces/PolicyI
|
|
|
28
28
|
var azure_exports = /* @__PURE__ */ __exportAll({
|
|
29
29
|
addAssignees: () => addAssignees,
|
|
30
30
|
addReviewers: () => addReviewers,
|
|
31
|
+
applyRepoConfig: () => applyRepoConfig,
|
|
31
32
|
createPr: () => createPr,
|
|
32
33
|
deleteLabel: () => deleteLabel,
|
|
33
34
|
ensureComment: () => ensureComment,
|
|
@@ -116,6 +117,11 @@ async function getJsonFile(fileName, repoName, branchOrTag) {
|
|
|
116
117
|
const raw = await getRawFile(fileName, repoName, branchOrTag);
|
|
117
118
|
return parseJson(raw, fileName);
|
|
118
119
|
}
|
|
120
|
+
function applyRepoConfig({ azureWorkItemType }) {
|
|
121
|
+
if (!azureWorkItemType || azureWorkItemType === config.workItemType) return;
|
|
122
|
+
config.workItemType = azureWorkItemType;
|
|
123
|
+
issueService = new IssueService(config);
|
|
124
|
+
}
|
|
119
125
|
async function initRepo({ repository, cloneSubmodules, cloneSubmodulesFilter, azureWorkItemType }) {
|
|
120
126
|
logger.debug(`initRepo("${repository}")`);
|
|
121
127
|
config = {
|
|
@@ -629,6 +635,6 @@ async function deleteLabel(prNumber, label) {
|
|
|
629
635
|
await (await gitApi()).deletePullRequestLabels(config.repoId, prNumber, label);
|
|
630
636
|
}
|
|
631
637
|
//#endregion
|
|
632
|
-
export { addAssignees, addReviewers, azure_exports, createPr, deleteLabel, ensureComment, ensureCommentRemoval, ensureIssue, ensureIssueClosing, findIssue, findPr, getBranchPr, getBranchStatus, getBranchStatusCheck, getIssueList, getJsonFile, getPr, getPrList, getRawFile, getRepos, id, initPlatform, initRepo, massageMarkdown, maxBodyLength, mergePr, reattemptPlatformAutomerge, setBranchStatus, updatePr };
|
|
638
|
+
export { addAssignees, addReviewers, applyRepoConfig, azure_exports, createPr, deleteLabel, ensureComment, ensureCommentRemoval, ensureIssue, ensureIssueClosing, findIssue, findPr, getBranchPr, getBranchStatus, getBranchStatusCheck, getIssueList, getJsonFile, getPr, getPrList, getRawFile, getRepos, id, initPlatform, initRepo, massageMarkdown, maxBodyLength, mergePr, reattemptPlatformAutomerge, setBranchStatus, updatePr };
|
|
633
639
|
|
|
634
640
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["azureApi.getAuthenticatedUserId","azureApi.gitApi","hostRules.find","git.initRepo","azureHelper.getMergeMethod","azureHelper.getPolicyEvaluations","azureApi.coreApi","azureHelper.getAllProjectTeams"],"sources":["../../../../lib/modules/platform/azure/index.ts"],"sourcesContent":["import { setTimeout } from 'node:timers/promises';\nimport { isString } from '@sindresorhus/is';\nimport type { IGitApi } from 'azure-devops-node-api/GitApi.js';\nimport type {\n GitItem,\n GitPullRequest,\n GitPullRequestCommentThread,\n GitPullRequestSearchCriteria,\n GitStatus,\n GitVersionDescriptor,\n} from 'azure-devops-node-api/interfaces/GitInterfaces.js';\nimport {\n GitPullRequestMergeStrategy,\n GitStatusState,\n GitVersionType,\n PullRequestStatus,\n} from 'azure-devops-node-api/interfaces/GitInterfaces.js';\nimport type { PolicyEvaluationRecord } from 'azure-devops-node-api/interfaces/PolicyInterfaces.js';\nimport { PolicyEvaluationStatus } from 'azure-devops-node-api/interfaces/PolicyInterfaces.js';\nimport { getConfig } from '../../../config/defaults.ts';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport {\n REPOSITORY_ARCHIVED,\n REPOSITORY_EMPTY,\n REPOSITORY_NOT_FOUND,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport type { BranchStatus } from '../../../types/index.ts';\nimport { parseJson } from '../../../util/common.ts';\nimport * as git from '../../../util/git/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { sanitize } from '../../../util/sanitize.ts';\nimport { ensureTrailingSlash } from '../../../util/url.ts';\nimport { getPrBodyStruct } from '../pr-body.ts';\nimport type {\n BranchStatusConfig,\n CreatePRConfig,\n EnsureCommentConfig,\n EnsureCommentRemovalConfig,\n EnsureIssueConfig,\n EnsureIssueResult,\n FindPRConfig,\n Issue,\n MergePRConfig,\n PlatformParams,\n PlatformPrOptions,\n PlatformResult,\n Pr,\n ReattemptPlatformAutomergeConfig,\n RepoParams,\n RepoResult,\n UpdatePrConfig,\n} from '../types.ts';\nimport { getNewBranchName, repoFingerprint } from '../util.ts';\nimport { smartTruncate } from '../utils/pr-body.ts';\nimport { readOnlyIssueBody } from '../utils/read-only-issue-body.ts';\nimport * as azureApi from './azure-got-wrapper.ts';\nimport * as azureHelper from './azure-helper.ts';\nimport { IssueService } from './issue.ts';\nimport type { AzurePr, Config } from './types.ts';\nimport { AzurePrVote } from './types.ts';\nimport {\n getBranchNameWithoutRefsheadsPrefix,\n getGitStatusContextCombinedName,\n getGitStatusContextFromCombinedName,\n getRenovatePRFormat,\n getRepoByName,\n getStorageExtraCloneOpts,\n mapMergeStrategy,\n max4000Chars,\n} from './util.ts';\n\ninterface User {\n id: string;\n name: string;\n isRequired: boolean;\n}\n\ninterface GetRepoPullRequestsOptions {\n gitApi: IGitApi;\n searchCriteria: GitPullRequestSearchCriteria;\n skip: number;\n top: number;\n}\n\nlet config: Config = {} as any;\nlet issueService: IssueService;\nlet renovateUserId: string | undefined;\n\nconst defaults: {\n endpoint?: string;\n hostType: string;\n} = {\n hostType: 'azure',\n};\n\nfunction getRepoPullRequests({\n gitApi,\n searchCriteria,\n skip,\n top,\n}: GetRepoPullRequestsOptions): Promise<GitPullRequest[]> {\n const maxCommentLength = 0;\n return gitApi.getPullRequests(\n config.repoId,\n searchCriteria,\n config.project,\n maxCommentLength,\n skip,\n top,\n );\n}\n\nexport const id = 'azure';\n\nexport function initPlatform({\n endpoint,\n token,\n username,\n password,\n}: PlatformParams): Promise<PlatformResult> {\n if (!endpoint) {\n throw new Error('Init: You must configure an Azure DevOps endpoint');\n }\n if (!token && !(username && password)) {\n throw new Error(\n 'Init: You must configure an Azure DevOps token, or a username and password',\n );\n }\n // TODO: Add a connection check that endpoint/token combination are valid (#9593)\n const res = {\n endpoint: ensureTrailingSlash(endpoint),\n };\n defaults.endpoint = res.endpoint;\n azureApi.setEndpoint(res.endpoint);\n const credentials = token\n ? { token }\n : { username: username!, password: password! };\n return azureApi.getAuthenticatedUserId(credentials).then((userId) => {\n renovateUserId = userId;\n return res;\n });\n}\n\nexport async function getRepos(): Promise<string[]> {\n logger.debug('Autodiscovering Azure DevOps repositories');\n const azureApiGit = await azureApi.gitApi();\n const repos = await azureApiGit.getRepositories();\n return repos\n .filter((repo) => repo.isDisabled !== true)\n .map((repo) => `${repo.project?.name}/${repo.name}`);\n}\n\nexport async function getRawFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n): Promise<string | null> {\n try {\n const azureApiGit = await azureApi.gitApi();\n\n let repoId: string | undefined;\n if (repoName) {\n const repos = await azureApiGit.getRepositories();\n const repo = getRepoByName(repoName, repos);\n repoId = repo?.id;\n } else {\n repoId = config.repoId;\n }\n\n if (!repoId) {\n logger.debug('No repoId so cannot getRawFile');\n return null;\n }\n\n let item: GitItem | undefined;\n const versionDescriptor: GitVersionDescriptor = {\n version: branchOrTag,\n } satisfies GitVersionDescriptor;\n // Try to get file from repo with tag first, if not found, then try with branch #36835\n for (const versionType of [GitVersionType.Tag, GitVersionType.Branch]) {\n versionDescriptor.versionType = versionType;\n\n item = await azureApiGit.getItem(\n repoId, // repositoryId\n fileName, // path\n undefined, // project\n undefined, // scopePath\n undefined, // recursionLevel\n undefined, // includeContentMetadata\n undefined, // latestProcessedChange\n undefined, // download\n branchOrTag ? versionDescriptor : undefined, // versionDescriptor\n true, // includeContent\n );\n if (item) {\n break; // exit loop if item is found\n } else {\n logger.debug(\n `File: ${fileName} not found in ${repoName} with ${versionType}: ${branchOrTag}`,\n );\n }\n }\n return item?.content ?? null;\n } catch (err) /* v8 ignore next -- Azure API failure modes (service unavailable, malformed items) are not mocked in specs */ {\n if (\n err.message?.includes('<title>Azure DevOps Services Unavailable</title>')\n ) {\n logger.debug(\n 'Azure DevOps is currently unavailable when attempting to fetch file - throwing ExternalHostError',\n );\n throw new ExternalHostError(err, id);\n }\n if (err.code === 'ECONNRESET' || err.code === 'ETIMEDOUT') {\n throw new ExternalHostError(err, id);\n }\n if (err.statusCode && err.statusCode >= 500 && err.statusCode < 600) {\n throw new ExternalHostError(err, id);\n }\n throw err;\n }\n}\n\nexport async function getJsonFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n): Promise<any> {\n const raw = await getRawFile(fileName, repoName, branchOrTag);\n return parseJson(raw, fileName);\n}\n\nexport async function initRepo({\n repository,\n cloneSubmodules,\n cloneSubmodulesFilter,\n azureWorkItemType,\n}: RepoParams): Promise<RepoResult> {\n logger.debug(`initRepo(\"${repository}\")`);\n config = {\n ignorePrAuthor: GlobalConfig.get('ignorePrAuthor'),\n repository,\n } as Config;\n const azureApiGit = await azureApi.gitApi();\n const repos = await azureApiGit.getRepositories();\n const repo = getRepoByName(repository, repos);\n if (!repo) {\n logger.error({ repos, repo }, 'Could not find repo in repo list');\n throw new Error(REPOSITORY_NOT_FOUND);\n }\n logger.debug({ repositoryDetails: repo }, 'Repository details');\n if (repo.isDisabled) {\n logger.debug('Repository is disabled- throwing error to abort renovation');\n throw new Error(REPOSITORY_ARCHIVED);\n }\n /* v8 ignore next -- defensive: Azure omits defaultBranch only for empty repos, which abort earlier in specs */\n if (!repo.defaultBranch) {\n logger.debug('Repo is empty');\n throw new Error(REPOSITORY_EMPTY);\n }\n // TODO #22198\n config.repoId = repo.id!;\n\n config.project = repo.project!.name!;\n config.projectId = repo.project!.id!;\n config.workItemType = azureWorkItemType ?? getConfig().azureWorkItemType!;\n issueService = new IssueService(config);\n config.owner = '?owner?';\n logger.debug(`${repository} owner = ${config.owner}`);\n const defaultBranch = repo.defaultBranch.replace('refs/heads/', '');\n config.defaultBranch = defaultBranch;\n logger.debug(`${repository} default branch = ${defaultBranch}`);\n config.mergeMethods = {};\n config.repoForceRebase = false;\n\n const [projectName, repoName] = repository.split('/');\n const opts = hostRules.find({\n hostType: defaults.hostType,\n url: defaults.endpoint,\n });\n // TODO: types (#22198)\n const manualUrl = `${defaults.endpoint!}${encodeURIComponent(\n projectName,\n )}/_git/${encodeURIComponent(repoName)}`;\n const url = repo.remoteUrl ?? manualUrl;\n await git.initRepo({\n ...config,\n url,\n extraCloneOpts: getStorageExtraCloneOpts(opts),\n cloneSubmodules,\n cloneSubmodulesFilter,\n });\n const repoConfig: RepoResult = {\n defaultBranch,\n isFork: false,\n repoFingerprint: repoFingerprint(repo.id!, defaults.endpoint),\n };\n return repoConfig;\n}\n\nexport async function getPrList(): Promise<AzurePr[]> {\n logger.debug('getPrList()');\n if (!config.prList) {\n const azureApiGit = await azureApi.gitApi();\n\n let prs: GitPullRequest[] = [];\n let fetchedPrs: GitPullRequest[];\n let skip = 0;\n do {\n fetchedPrs = await getRepoPullRequests({\n gitApi: azureApiGit,\n searchCriteria: {\n status: PullRequestStatus.All,\n // fetch only prs directly created on the repo and not by forks\n sourceRepositoryId: config.repoId,\n ...(!config.ignorePrAuthor &&\n renovateUserId && { creatorId: renovateUserId }),\n },\n skip,\n top: 100,\n });\n prs = prs.concat(fetchedPrs);\n skip += 100;\n } while (fetchedPrs.length > 0);\n\n config.prList = prs.map(getRenovatePRFormat);\n logger.debug(`Retrieved Pull Requests count: ${config.prList.length}`);\n }\n return config.prList;\n}\n\nexport async function getPr(pullRequestId: number): Promise<Pr | null> {\n logger.debug(`getPr(${pullRequestId})`);\n if (!pullRequestId) {\n return null;\n }\n const azurePr = (await getPrList()).find(\n (item) => item.number === pullRequestId,\n );\n\n if (!azurePr) {\n return null;\n }\n\n const azureApiGit = await azureApi.gitApi();\n // the PR list returns descriptions truncated to 400 characters, so read the\n // full one for the body hash\n const { description } = await azureApiGit.getPullRequestById(\n pullRequestId,\n config.project,\n );\n azurePr.bodyStruct = getPrBodyStruct(description);\n\n const labels = await azureApiGit.getPullRequestLabels(\n config.repoId,\n pullRequestId,\n );\n\n azurePr.labels = labels\n .filter((label) => label.active)\n .map((label) => label.name)\n .filter(isString);\n return azurePr;\n}\n\nexport async function findPr({\n branchName,\n prTitle,\n state = 'all',\n targetBranch,\n includeOtherAuthors,\n}: FindPRConfig): Promise<Pr | null> {\n let prsFiltered: Pr[] = [];\n try {\n if (includeOtherAuthors) {\n const azureApiGit = await azureApi.gitApi();\n const [pr] = await getRepoPullRequests({\n gitApi: azureApiGit,\n searchCriteria: {\n sourceRefName: getNewBranchName(branchName),\n sourceRepositoryId: config.repoId,\n status: PullRequestStatus.Active,\n ...(targetBranch && {\n targetRefName: getNewBranchName(targetBranch),\n }),\n },\n skip: 0,\n top: 1,\n });\n return pr ? getRenovatePRFormat(pr) : null;\n }\n\n const prs = await getPrList();\n\n prsFiltered = prs.filter(\n (item) => item.sourceRefName === getNewBranchName(branchName),\n );\n\n if (prTitle) {\n prsFiltered = prsFiltered.filter(\n (item) => item.title.toUpperCase() === prTitle.toUpperCase(),\n );\n }\n\n switch (state) {\n case 'all':\n // no more filter needed, we can go further...\n break;\n case '!open':\n prsFiltered = prsFiltered.filter((item) => item.state !== 'open');\n break;\n default:\n prsFiltered = prsFiltered.filter((item) => item.state === state);\n break;\n }\n } catch (err) {\n logger.error({ err }, 'findPr error');\n }\n if (prsFiltered.length === 0) {\n return null;\n }\n if (targetBranch && prsFiltered.length > 1) {\n const pr = prsFiltered.find((item) => item.targetBranch === targetBranch);\n if (pr) {\n return pr;\n }\n }\n return prsFiltered[0];\n}\n\nexport async function getBranchPr(\n branchName: string,\n targetBranch?: string,\n): Promise<Pr | null> {\n logger.debug(`getBranchPr(${branchName}, ${targetBranch})`);\n const existingPr = await findPr({\n branchName,\n state: 'open',\n targetBranch,\n });\n return existingPr ? getPr(existingPr.number) : null;\n}\n\nasync function getStatusCheck(branchName: string): Promise<GitStatus[]> {\n const azureApiGit = await azureApi.gitApi();\n const branch = await azureApiGit.getBranch(\n config.repoId,\n\n // TODO: fix undefined (#22198)\n getBranchNameWithoutRefsheadsPrefix(branchName)!,\n );\n // only grab the latest statuses, it will group any by context\n return azureApiGit.getStatuses(\n // TODO #22198\n branch.commit!.commitId!,\n config.repoId,\n undefined,\n undefined,\n undefined,\n true,\n );\n}\n\nconst azureToRenovateStatusMapping: Record<GitStatusState, BranchStatus> = {\n [GitStatusState.Succeeded]: 'green',\n [GitStatusState.NotApplicable]: 'green',\n [GitStatusState.NotSet]: 'yellow',\n [GitStatusState.Pending]: 'yellow',\n [GitStatusState.PartiallySucceeded]: 'yellow',\n [GitStatusState.Error]: 'red',\n [GitStatusState.Failed]: 'red',\n};\n\nexport async function getBranchStatusCheck(\n branchName: string,\n context: string,\n): Promise<BranchStatus | null> {\n const res = await getStatusCheck(branchName);\n for (const check of res) {\n if (getGitStatusContextCombinedName(check.context) === context) {\n // TODO #22198\n return azureToRenovateStatusMapping[check.state!] ?? 'yellow';\n }\n }\n return null;\n}\n\nexport async function getBranchStatus(\n branchName: string,\n internalChecksAsSuccess: boolean,\n): Promise<BranchStatus> {\n logger.debug(`getBranchStatus(${branchName})`);\n const statuses = await getStatusCheck(branchName);\n logger.debug({ branch: branchName, statuses }, 'branch status check result');\n if (!statuses.length) {\n logger.debug('empty branch status check result = returning \"pending\"');\n return 'yellow';\n }\n const noOfFailures = statuses.filter(\n (status) =>\n status.state === GitStatusState.Error ||\n status.state === GitStatusState.Failed,\n ).length;\n if (noOfFailures) {\n return 'red';\n }\n const noOfPending = statuses.filter(\n (status) =>\n status.state === GitStatusState.NotSet ||\n status.state === GitStatusState.Pending,\n ).length;\n if (noOfPending) {\n return 'yellow';\n }\n if (\n !internalChecksAsSuccess &&\n statuses.every(\n (status) =>\n status.state === GitStatusState.Succeeded &&\n status.context?.genre === 'renovate',\n )\n ) {\n logger.debug(\n 'Successful checks are all internal renovate/ checks, so returning \"pending\" branch status',\n );\n return 'yellow';\n }\n return 'green';\n}\n\nasync function getMergeStrategy(\n targetRefName: string,\n): Promise<GitPullRequestMergeStrategy> {\n return (\n config.mergeMethods[targetRefName] ??\n (config.mergeMethods[targetRefName] = await azureHelper.getMergeMethod(\n config.repoId,\n config.project,\n targetRefName,\n config.defaultBranch,\n ))\n );\n}\n\nasync function getPendingBlockingPolicyEvaluations(\n pullRequestId: number,\n): Promise<PolicyEvaluationRecord[]> {\n const artifactId = `vstfs:///CodeReview/CodeReviewId/${config.projectId}/${pullRequestId}`;\n const policyEvaluations = await azureHelper.getPolicyEvaluations(\n config.project,\n artifactId,\n );\n logger.debug(\n { pullRequestId, artifactId, policyEvaluations },\n 'Retrieved policy evaluations for PR',\n );\n return policyEvaluations.filter(\n (evaluation) =>\n evaluation.configuration?.isBlocking &&\n evaluation.status !== PolicyEvaluationStatus.Approved &&\n evaluation.status !== PolicyEvaluationStatus.NotApplicable,\n );\n}\n\nasync function setPlatformAutomerge(\n azureApiGit: IGitApi,\n pr: GitPullRequest,\n platformPrOptions: PlatformPrOptions,\n): Promise<GitPullRequest> {\n let mergeStrategy: GitPullRequestMergeStrategy;\n if (platformPrOptions.automergeStrategy === 'auto') {\n mergeStrategy = await getMergeStrategy(pr.targetRefName!);\n } else {\n mergeStrategy = mapMergeStrategy(platformPrOptions.automergeStrategy);\n }\n const prOptions: GitPullRequest = {\n autoCompleteSetBy: {\n // TODO #22198\n id: pr.createdBy!.id,\n },\n completionOptions: {\n mergeStrategy,\n deleteSourceBranch: true,\n mergeCommitMessage: pr.title,\n },\n };\n\n logger.debug(\n {\n prOptions,\n repoId: config.repoId,\n pullRequestId: pr.pullRequestId!,\n },\n // TODO #22198\n `Updating PR ${pr.pullRequestId!} to specify platformAutomerge settings`,\n );\n\n return await azureApiGit.updatePullRequest(\n prOptions,\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n );\n}\n\nexport async function reattemptPlatformAutomerge({\n number,\n platformPrOptions,\n}: ReattemptPlatformAutomergeConfig): Promise<void> {\n try {\n const azureApiGit = await azureApi.gitApi();\n const pr = await azureApiGit.getPullRequestById(number, config.project);\n await setPlatformAutomerge(\n azureApiGit,\n pr,\n coerceObject(platformPrOptions),\n );\n\n logger.debug(`PR platform automerge re-attempted...prNo: ${number}`);\n } catch (err) {\n logger.warn({ err }, 'Error re-attempting PR platform automerge');\n }\n}\n\nexport async function createPr({\n sourceBranch,\n targetBranch,\n prTitle: title,\n prBody: body,\n labels,\n draftPR = false,\n platformPrOptions,\n}: CreatePRConfig): Promise<Pr> {\n const sourceRefName = getNewBranchName(sourceBranch);\n const targetRefName = getNewBranchName(targetBranch);\n const description = max4000Chars(sanitize(body));\n const azureApiGit = await azureApi.gitApi();\n const workItemRefs = [\n {\n id: platformPrOptions?.azureWorkItemId?.toString(),\n },\n ];\n let pr: GitPullRequest = await azureApiGit.createPullRequest(\n {\n sourceRefName,\n targetRefName,\n title,\n description,\n workItemRefs,\n isDraft: draftPR,\n },\n config.repoId,\n );\n if (platformPrOptions?.usePlatformAutomerge) {\n pr = await setPlatformAutomerge(azureApiGit, pr, platformPrOptions);\n }\n if (platformPrOptions?.autoApprove) {\n const approver = {\n reviewerUrl: pr.createdBy!.url,\n vote: AzurePrVote.Approved,\n isFlagged: false,\n isRequired: false,\n };\n\n logger.debug(\n {\n approver,\n\n repoId: config.repoId,\n // TODO #22198\n pullRequestId: pr.pullRequestId!,\n prCreatedBy: {\n id: pr.createdBy!.id!,\n },\n },\n // TODO #22198\n `Auto-approving PR ${pr.pullRequestId!}`,\n );\n\n await azureApiGit.createPullRequestReviewer(\n approver,\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n pr.createdBy!.id!,\n );\n }\n await Promise.all(\n labels!.map((label) =>\n azureApiGit.createPullRequestLabel(\n {\n name: label,\n },\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n ),\n ),\n );\n\n const result = getRenovatePRFormat(pr);\n if (config.prList) {\n config.prList.push(result);\n }\n return result;\n}\n\nexport async function updatePr({\n number: prNo,\n prTitle: title,\n prBody: body,\n state,\n platformPrOptions,\n targetBranch,\n}: UpdatePrConfig): Promise<void> {\n logger.debug(`updatePr(${prNo}, ${title}, body)`);\n\n const azureApiGit = await azureApi.gitApi();\n const objToUpdate: GitPullRequest = {\n title,\n };\n\n if (targetBranch) {\n objToUpdate.targetRefName = getNewBranchName(targetBranch);\n }\n\n if (body) {\n objToUpdate.description = max4000Chars(sanitize(body));\n }\n\n if (state === 'open') {\n await azureApiGit.updatePullRequest(\n {\n status: PullRequestStatus.Active,\n },\n config.repoId,\n prNo,\n );\n } else if (state === 'closed') {\n objToUpdate.status = PullRequestStatus.Abandoned;\n }\n if (platformPrOptions?.autoApprove) {\n const pr = await azureApiGit.getPullRequestById(prNo, config.project);\n await azureApiGit.createPullRequestReviewer(\n {\n reviewerUrl: pr.createdBy!.url,\n vote: AzurePrVote.Approved,\n isFlagged: false,\n isRequired: false,\n },\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n pr.createdBy!.id!,\n );\n }\n\n const updatedPr = await azureApiGit.updatePullRequest(\n objToUpdate,\n config.repoId,\n prNo,\n );\n if (config.prList) {\n const prToCache = getRenovatePRFormat(updatedPr);\n // We need to update the cached entry for this PR\n const existingIndex = config.prList.findIndex(\n (item) => item.number === prNo,\n );\n /* v8 ignore next: should not happen */\n if (existingIndex === -1) {\n logger.warn({ prNo }, 'PR not found in cache');\n // Add to cache\n config.prList.push(prToCache);\n } else {\n // overwrite existing PR in cache\n config.prList[existingIndex] = prToCache;\n }\n }\n}\n\nexport async function ensureComment({\n number,\n topic,\n content,\n}: EnsureCommentConfig): Promise<boolean> {\n logger.debug(`ensureComment(${number}, ${topic!}, content)`);\n const header = topic ? `### ${topic}\\n\\n` : '';\n const body = `${header}${sanitize(massageMarkdown(content))}`;\n const azureApiGit = await azureApi.gitApi();\n\n const threads = await azureApiGit.getThreads(config.repoId, number);\n let threadIdFound: number | undefined;\n let commentIdFound: number | undefined;\n let commentNeedsUpdating = false;\n threads.forEach((thread) => {\n const firstCommentContent = thread.comments?.[0].content;\n if (\n (topic && firstCommentContent?.startsWith(header)) === true ||\n (!topic && firstCommentContent === body)\n ) {\n threadIdFound = thread.id;\n commentIdFound = thread.comments?.[0].id;\n commentNeedsUpdating = firstCommentContent !== body;\n }\n });\n\n if (!threadIdFound) {\n await azureApiGit.createThread(\n {\n comments: [{ content: body, commentType: 1, parentCommentId: 0 }],\n status: 1,\n },\n config.repoId,\n number,\n );\n logger.info(\n { repository: config.repository, issueNo: number, topic },\n 'Comment added',\n );\n } else if (commentNeedsUpdating) {\n await azureApiGit.updateComment(\n {\n content: body,\n },\n config.repoId,\n number,\n threadIdFound,\n // TODO #22198\n commentIdFound!,\n );\n logger.debug(\n { repository: config.repository, issueNo: number, topic },\n 'Comment updated',\n );\n } else {\n logger.debug(\n { repository: config.repository, issueNo: number, topic },\n 'Comment is already up-to-date',\n );\n }\n\n return true;\n}\n\nexport async function ensureCommentRemoval(\n removeConfig: EnsureCommentRemovalConfig,\n): Promise<void> {\n const { number: issueNo } = removeConfig;\n const key =\n removeConfig.type === 'by-topic'\n ? removeConfig.topic\n : removeConfig.content;\n logger.debug(`Ensuring comment \"${key}\" in #${issueNo} is removed`);\n\n const azureApiGit = await azureApi.gitApi();\n const threads = await azureApiGit.getThreads(config.repoId, issueNo);\n\n let threadIdFound: number | null | undefined = null;\n if (removeConfig.type === 'by-topic') {\n const thread = threads.find(\n (thread: GitPullRequestCommentThread): boolean =>\n !!thread.comments?.[0].content?.startsWith(\n `### ${removeConfig.topic}\\n\\n`,\n ),\n );\n threadIdFound = thread?.id;\n } else {\n const thread = threads.find(\n (thread: GitPullRequestCommentThread): boolean =>\n thread.comments?.[0].content?.trim() === removeConfig.content,\n );\n threadIdFound = thread?.id;\n }\n\n if (threadIdFound) {\n await azureApiGit.updateThread(\n {\n status: 4, // close\n },\n config.repoId,\n issueNo,\n threadIdFound,\n );\n }\n}\n\nconst renovateToAzureStatusMapping: Record<BranchStatus, GitStatusState> = {\n ['green']: GitStatusState.Succeeded,\n ['yellow']: GitStatusState.Pending,\n ['red']: GitStatusState.Failed,\n};\n\nexport async function setBranchStatus({\n branchName,\n context,\n description,\n state,\n url: targetUrl,\n}: BranchStatusConfig): Promise<void> {\n logger.debug(\n `setBranchStatus(${branchName}, ${context}, ${description}, ${state}, ${targetUrl!})`,\n );\n const azureApiGit = await azureApi.gitApi();\n const branch = await azureApiGit.getBranch(\n config.repoId,\n getBranchNameWithoutRefsheadsPrefix(branchName)!,\n );\n const statusToCreate: GitStatus = {\n description,\n context: getGitStatusContextFromCombinedName(context),\n state: renovateToAzureStatusMapping[state],\n targetUrl,\n };\n await azureApiGit.createCommitStatus(\n statusToCreate,\n // TODO #22198\n branch.commit!.commitId!,\n config.repoId,\n );\n logger.trace(`Created commit status of ${state} on branch ${branchName}`);\n}\n\nexport async function mergePr({\n branchName,\n id: pullRequestId,\n strategy,\n}: MergePRConfig): Promise<boolean> {\n logger.debug(`mergePr(${pullRequestId}, ${branchName!})`);\n\n const pendingPolicyEvaluations =\n await getPendingBlockingPolicyEvaluations(pullRequestId);\n if (pendingPolicyEvaluations.length) {\n logger.debug(\n {\n pullRequestId,\n pendingPolicies: pendingPolicyEvaluations.map((evaluation) => ({\n name: evaluation.configuration?.type?.displayName,\n status: PolicyEvaluationStatus[evaluation.status!],\n })),\n },\n 'Not completing PR because branch policies have not been satisfied yet',\n );\n return false;\n }\n\n const azureApiGit = await azureApi.gitApi();\n\n let pr = await azureApiGit.getPullRequestById(pullRequestId, config.project);\n\n const mergeStrategy =\n strategy === 'auto'\n ? await getMergeStrategy(pr.targetRefName!)\n : mapMergeStrategy(strategy);\n const objToUpdate: GitPullRequest = {\n status: PullRequestStatus.Completed,\n lastMergeSourceCommit: pr.lastMergeSourceCommit,\n completionOptions: {\n mergeStrategy,\n deleteSourceBranch: true,\n mergeCommitMessage: pr.title,\n },\n };\n\n logger.trace(\n `Updating PR ${pullRequestId} to status ${PullRequestStatus.Completed} (${\n PullRequestStatus[PullRequestStatus.Completed]\n }) with lastMergeSourceCommit ${\n // TODO: types (#22198)\n pr.lastMergeSourceCommit?.commitId\n } using mergeStrategy ${mergeStrategy} (${\n GitPullRequestMergeStrategy[mergeStrategy]\n })`,\n );\n\n try {\n const response = await azureApiGit.updatePullRequest(\n objToUpdate,\n config.repoId,\n pullRequestId,\n );\n\n let retries = 0;\n let isClosed = response.status === PullRequestStatus.Completed;\n while (!isClosed && retries < 5) {\n retries += 1;\n const sleepMs = retries * 1000;\n logger.trace(\n { pullRequestId, status: pr.status, retries },\n `Updated PR to closed status but change has not taken effect yet. Retrying...`,\n );\n\n await setTimeout(sleepMs);\n pr = await azureApiGit.getPullRequestById(pullRequestId, config.project);\n isClosed = pr.status === PullRequestStatus.Completed;\n }\n\n if (!isClosed) {\n logger.warn(\n {\n pullRequestId,\n status: pr.status,\n expectedPRStatus: PullRequestStatus[PullRequestStatus.Completed],\n actualPRStatus: PullRequestStatus[pr.status!],\n },\n 'Expected PR to have completed status. However, the PR has a different status',\n );\n }\n return true;\n } catch (err) {\n logger.debug({ err }, 'Failed to set the PR as completed.');\n return false;\n }\n}\n\nexport function massageMarkdown(input: string): string {\n // Remove any HTML we use\n return (\n smartTruncate(readOnlyIssueBody(input), maxBodyLength())\n .replace(\n 'you tick the rebase/retry checkbox',\n 'PR is renamed to start with \"rebase!\"',\n )\n .replace(\n 'checking the rebase/retry box above',\n 'renaming the PR to start with \"rebase!\"',\n )\n .replace(regEx(`\\n---\\n\\n.*?<!-- rebase-check -->.*?\\n`), '')\n .replace(regEx(/<!--renovate-(?:debug|config-hash):.*?-->/g), '')\n // Replace GitHub-style PR links with Azure DevOps format\n .replace(regEx(/\\]\\(\\.\\.\\/pull\\//g), '](!')\n // Replace GitHub-style PR references (#123) with Azure DevOps format, needed for text linking config migration PR.\n // Only match a standalone reference (preceded by start, whitespace or `(`) so we don't corrupt\n // HTML entities like `​` or URL anchors like `CHANGELOG.md#4780`.\n .replace(regEx(/(?<lead>^|[\\s(])#(?<num>\\d+)/g), '$<lead>!$<num>')\n );\n}\n\nexport function maxBodyLength(): number {\n return 4000;\n}\n\nexport async function findIssue(title: string): Promise<Issue | null> {\n return await issueService.findIssue(title);\n}\n\nexport async function ensureIssue(\n issueConfig: EnsureIssueConfig,\n): Promise<EnsureIssueResult | null> {\n return await issueService.ensureIssue(issueConfig);\n}\n\nexport async function ensureIssueClosing(title: string): Promise<void> {\n return await issueService.ensureIssueClosing(title);\n}\n\nexport async function getIssueList(titleFilter?: string): Promise<Issue[]> {\n return await issueService.getIssueList(titleFilter);\n}\n\nasync function getUserIds(users: string[]): Promise<User[]> {\n const azureApiGit = await azureApi.gitApi();\n const azureApiCore = await azureApi.coreApi();\n const repos = await azureApiGit.getRepositories();\n const repo = repos.find((c) => c.id === config.repoId)!;\n const requiredReviewerPrefix = 'required:';\n const validReviewers = new Set<string>();\n\n // TODO #22198\n const teams = await azureHelper.getAllProjectTeams(repo.project!.id!);\n const members = await Promise.all(\n teams.map(\n async (t) =>\n await azureApiCore.getTeamMembersWithExtendedProperties(\n // TODO #22198\n repo.project!.id!,\n t.id!,\n ),\n ),\n );\n\n const ids: { id: string; name: string; isRequired: boolean }[] = [];\n members.forEach((listMembers) => {\n listMembers.forEach((m) => {\n users.forEach((r) => {\n let reviewer = r;\n let isRequired = false;\n if (reviewer.startsWith(requiredReviewerPrefix)) {\n reviewer = reviewer.replace(requiredReviewerPrefix, '');\n isRequired = true;\n }\n if (\n (reviewer.toLowerCase() === m.identity?.displayName?.toLowerCase() ||\n reviewer.toLowerCase() === m.identity?.uniqueName?.toLowerCase()) &&\n ids.filter((c) => c.id === m.identity?.id).length === 0\n ) {\n // TODO #22198\n ids.push({\n id: m.identity.id!,\n name: reviewer,\n isRequired,\n });\n\n validReviewers.add(reviewer);\n }\n });\n });\n });\n\n teams.forEach((t) => {\n users.forEach((r) => {\n let reviewer = r;\n let isRequired = false;\n if (reviewer.startsWith(requiredReviewerPrefix)) {\n reviewer = reviewer.replace(requiredReviewerPrefix, '');\n isRequired = true;\n }\n // v8 ignore else -- TODO: add test #40625\n if (\n reviewer.toLowerCase() === t.name?.toLowerCase() &&\n ids.filter((c) => c.id === t.id).length === 0\n ) {\n // TODO #22198\n ids.push({ id: t.id!, name: reviewer, isRequired });\n\n validReviewers.add(reviewer);\n }\n });\n });\n\n for (const u of users) {\n const reviewer = u.replace(requiredReviewerPrefix, '');\n if (!validReviewers.has(reviewer)) {\n logger.once.info(\n `${reviewer} is neither an Azure DevOps Team nor a user associated with a Team`,\n );\n }\n }\n\n return ids;\n}\n\n/**\n *\n * @param {number} issueNo\n * @param {string[]} assignees\n */\nexport async function addAssignees(\n issueNo: number,\n assignees: string[],\n): Promise<void> {\n logger.trace(`addAssignees(${issueNo}, [${assignees.join(', ')}])`);\n const ids = await getUserIds(assignees);\n await ensureComment({\n number: issueNo,\n topic: 'Add Assignees',\n content: ids.map((a) => `@<${a.id}>`).join(', '),\n });\n}\n\n/**\n *\n * @param {number} prNo\n * @param {string[]} reviewers\n */\nexport async function addReviewers(\n prNo: number,\n reviewers: string[],\n): Promise<void> {\n logger.trace(`addReviewers(${prNo}, [${reviewers.join(', ')}])`);\n const azureApiGit = await azureApi.gitApi();\n\n const ids = await getUserIds(reviewers);\n\n await Promise.all(\n ids.map(async (obj) => {\n await azureApiGit.createPullRequestReviewer(\n {\n isRequired: obj.isRequired,\n },\n config.repoId,\n prNo,\n obj.id,\n );\n logger.debug(`Reviewer added: ${obj.name}`);\n }),\n );\n}\n\nexport async function deleteLabel(\n prNumber: number,\n label: string,\n): Promise<void> {\n logger.debug(`Deleting label ${label} from #${prNumber}`);\n const azureApiGit = await azureApi.gitApi();\n await azureApiGit.deletePullRequestLabels(config.repoId, prNumber, label);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAI,SAAiB,CAAC;AACtB,IAAI;AACJ,IAAI;AAEJ,MAAM,WAGF,EACF,UAAU,QACZ;AAEA,SAAS,oBAAoB,EAC3B,QACA,gBACA,MACA,OACwD;CAExD,OAAO,OAAO,gBACZ,OAAO,QACP,gBACA,OAAO,SACP,GACA,MACA,GACF;AACF;AAEA,MAAa,KAAK;AAElB,SAAgB,aAAa,EAC3B,UACA,OACA,UACA,YAC0C;CAC1C,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,IAAI,CAAC,SAAS,EAAE,YAAY,WAC1B,MAAM,IAAI,MACR,4EACF;CAGF,MAAM,MAAM,EACV,UAAU,oBAAoB,QAAQ,EACxC;CACA,SAAS,WAAW,IAAI;CACxB,YAAqB,IAAI,QAAQ;CAIjC,OAAOA,uBAHa,QAChB,EAAE,MAAM,IACR;EAAY;EAAqB;CAAU,CACG,CAAC,CAAC,MAAM,WAAW;EACnE,iBAAiB;EACjB,OAAO;CACT,CAAC;AACH;AAEA,eAAsB,WAA8B;CAClD,OAAO,MAAM,2CAA2C;CAGxD,QAAO,OADa,MADMC,OAAgB,EAAA,CACV,gBAAgB,EAAA,CAE7C,QAAQ,SAAS,KAAK,eAAe,IAAI,CAAC,CAC1C,KAAK,SAAS,GAAG,KAAK,SAAS,KAAK,GAAG,KAAK,MAAM;AACvD;AAEA,eAAsB,WACpB,UACA,UACA,aACwB;CACxB,IAAI;EACF,MAAM,cAAc,MAAMA,OAAgB;EAE1C,IAAI;EACJ,IAAI,UAAU;GACZ,MAAM,QAAQ,MAAM,YA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ACP,UAAS,MAJO,WAAW,SAAS,EAAA,CAIvB,KAAK,MAAM,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI;CACjD,CAAC;AACH;;;;;;AAOA,eAAsB,aACpB,MACA,WACe;CACf,OAAO,MAAM,gBAAgB,KAAK,KAAK,UAAU,KAAK,IAAI,EAAE,GAAG;CAC/D,MAAM,cAAc,MAAMN,OAAgB;CAE1C,MAAM,MAAM,MAAM,WAAW,SAAS;CAEtC,MAAM,QAAQ,IACZ,IAAI,IAAI,OAAO,QAAQ;EACrB,MAAM,YAAY,0BAChB,EACE,YAAY,IAAI,WAClB,GACA,OAAO,QACP,MACA,IAAI,EACN;EACA,OAAO,MAAM,mBAAmB,IAAI,MAAM;CAC5C,CAAC,CACH;AACF;AAEA,eAAsB,YACpB,UACA,OACe;CACf,OAAO,MAAM,kBAAkB,MAAM,SAAS,UAAU;CAExD,OAAM,MADoBA,OAAgB,EAAA,CACxB,wBAAwB,OAAO,QAAQ,UAAU,KAAK;AAC1E"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["azureApi.getAuthenticatedUserId","azureApi.gitApi","hostRules.find","git.initRepo","azureHelper.getMergeMethod","azureHelper.getPolicyEvaluations","azureApi.coreApi","azureHelper.getAllProjectTeams"],"sources":["../../../../lib/modules/platform/azure/index.ts"],"sourcesContent":["import { setTimeout } from 'node:timers/promises';\nimport { isString } from '@sindresorhus/is';\nimport type { IGitApi } from 'azure-devops-node-api/GitApi.js';\nimport type {\n GitItem,\n GitPullRequest,\n GitPullRequestCommentThread,\n GitPullRequestSearchCriteria,\n GitStatus,\n GitVersionDescriptor,\n} from 'azure-devops-node-api/interfaces/GitInterfaces.js';\nimport {\n GitPullRequestMergeStrategy,\n GitStatusState,\n GitVersionType,\n PullRequestStatus,\n} from 'azure-devops-node-api/interfaces/GitInterfaces.js';\nimport type { PolicyEvaluationRecord } from 'azure-devops-node-api/interfaces/PolicyInterfaces.js';\nimport { PolicyEvaluationStatus } from 'azure-devops-node-api/interfaces/PolicyInterfaces.js';\nimport { getConfig } from '../../../config/defaults.ts';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport {\n REPOSITORY_ARCHIVED,\n REPOSITORY_EMPTY,\n REPOSITORY_NOT_FOUND,\n} from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport type { BranchStatus } from '../../../types/index.ts';\nimport { parseJson } from '../../../util/common.ts';\nimport * as git from '../../../util/git/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { sanitize } from '../../../util/sanitize.ts';\nimport { ensureTrailingSlash } from '../../../util/url.ts';\nimport { getPrBodyStruct } from '../pr-body.ts';\nimport type {\n BranchStatusConfig,\n CreatePRConfig,\n EnsureCommentConfig,\n EnsureCommentRemovalConfig,\n EnsureIssueConfig,\n EnsureIssueResult,\n FindPRConfig,\n Issue,\n MergePRConfig,\n PlatformParams,\n PlatformPrOptions,\n PlatformResult,\n Pr,\n ReattemptPlatformAutomergeConfig,\n RepoConfigParams,\n RepoParams,\n RepoResult,\n UpdatePrConfig,\n} from '../types.ts';\nimport { getNewBranchName, repoFingerprint } from '../util.ts';\nimport { smartTruncate } from '../utils/pr-body.ts';\nimport { readOnlyIssueBody } from '../utils/read-only-issue-body.ts';\nimport * as azureApi from './azure-got-wrapper.ts';\nimport * as azureHelper from './azure-helper.ts';\nimport { IssueService } from './issue.ts';\nimport type { AzurePr, Config } from './types.ts';\nimport { AzurePrVote } from './types.ts';\nimport {\n getBranchNameWithoutRefsheadsPrefix,\n getGitStatusContextCombinedName,\n getGitStatusContextFromCombinedName,\n getRenovatePRFormat,\n getRepoByName,\n getStorageExtraCloneOpts,\n mapMergeStrategy,\n max4000Chars,\n} from './util.ts';\n\ninterface User {\n id: string;\n name: string;\n isRequired: boolean;\n}\n\ninterface GetRepoPullRequestsOptions {\n gitApi: IGitApi;\n searchCriteria: GitPullRequestSearchCriteria;\n skip: number;\n top: number;\n}\n\nlet config: Config = {} as any;\nlet issueService: IssueService;\nlet renovateUserId: string | undefined;\n\nconst defaults: {\n endpoint?: string;\n hostType: string;\n} = {\n hostType: 'azure',\n};\n\nfunction getRepoPullRequests({\n gitApi,\n searchCriteria,\n skip,\n top,\n}: GetRepoPullRequestsOptions): Promise<GitPullRequest[]> {\n const maxCommentLength = 0;\n return gitApi.getPullRequests(\n config.repoId,\n searchCriteria,\n config.project,\n maxCommentLength,\n skip,\n top,\n );\n}\n\nexport const id = 'azure';\n\nexport function initPlatform({\n endpoint,\n token,\n username,\n password,\n}: PlatformParams): Promise<PlatformResult> {\n if (!endpoint) {\n throw new Error('Init: You must configure an Azure DevOps endpoint');\n }\n if (!token && !(username && password)) {\n throw new Error(\n 'Init: You must configure an Azure DevOps token, or a username and password',\n );\n }\n // TODO: Add a connection check that endpoint/token combination are valid (#9593)\n const res = {\n endpoint: ensureTrailingSlash(endpoint),\n };\n defaults.endpoint = res.endpoint;\n azureApi.setEndpoint(res.endpoint);\n const credentials = token\n ? { token }\n : { username: username!, password: password! };\n return azureApi.getAuthenticatedUserId(credentials).then((userId) => {\n renovateUserId = userId;\n return res;\n });\n}\n\nexport async function getRepos(): Promise<string[]> {\n logger.debug('Autodiscovering Azure DevOps repositories');\n const azureApiGit = await azureApi.gitApi();\n const repos = await azureApiGit.getRepositories();\n return repos\n .filter((repo) => repo.isDisabled !== true)\n .map((repo) => `${repo.project?.name}/${repo.name}`);\n}\n\nexport async function getRawFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n): Promise<string | null> {\n try {\n const azureApiGit = await azureApi.gitApi();\n\n let repoId: string | undefined;\n if (repoName) {\n const repos = await azureApiGit.getRepositories();\n const repo = getRepoByName(repoName, repos);\n repoId = repo?.id;\n } else {\n repoId = config.repoId;\n }\n\n if (!repoId) {\n logger.debug('No repoId so cannot getRawFile');\n return null;\n }\n\n let item: GitItem | undefined;\n const versionDescriptor: GitVersionDescriptor = {\n version: branchOrTag,\n } satisfies GitVersionDescriptor;\n // Try to get file from repo with tag first, if not found, then try with branch #36835\n for (const versionType of [GitVersionType.Tag, GitVersionType.Branch]) {\n versionDescriptor.versionType = versionType;\n\n item = await azureApiGit.getItem(\n repoId, // repositoryId\n fileName, // path\n undefined, // project\n undefined, // scopePath\n undefined, // recursionLevel\n undefined, // includeContentMetadata\n undefined, // latestProcessedChange\n undefined, // download\n branchOrTag ? versionDescriptor : undefined, // versionDescriptor\n true, // includeContent\n );\n if (item) {\n break; // exit loop if item is found\n } else {\n logger.debug(\n `File: ${fileName} not found in ${repoName} with ${versionType}: ${branchOrTag}`,\n );\n }\n }\n return item?.content ?? null;\n } catch (err) /* v8 ignore next -- Azure API failure modes (service unavailable, malformed items) are not mocked in specs */ {\n if (\n err.message?.includes('<title>Azure DevOps Services Unavailable</title>')\n ) {\n logger.debug(\n 'Azure DevOps is currently unavailable when attempting to fetch file - throwing ExternalHostError',\n );\n throw new ExternalHostError(err, id);\n }\n if (err.code === 'ECONNRESET' || err.code === 'ETIMEDOUT') {\n throw new ExternalHostError(err, id);\n }\n if (err.statusCode && err.statusCode >= 500 && err.statusCode < 600) {\n throw new ExternalHostError(err, id);\n }\n throw err;\n }\n}\n\nexport async function getJsonFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n): Promise<any> {\n const raw = await getRawFile(fileName, repoName, branchOrTag);\n return parseJson(raw, fileName);\n}\n\nexport function applyRepoConfig({ azureWorkItemType }: RepoConfigParams): void {\n if (!azureWorkItemType || azureWorkItemType === config.workItemType) {\n return;\n }\n config.workItemType = azureWorkItemType;\n issueService = new IssueService(config);\n}\n\nexport async function initRepo({\n repository,\n cloneSubmodules,\n cloneSubmodulesFilter,\n azureWorkItemType,\n}: RepoParams): Promise<RepoResult> {\n logger.debug(`initRepo(\"${repository}\")`);\n config = {\n ignorePrAuthor: GlobalConfig.get('ignorePrAuthor'),\n repository,\n } as Config;\n const azureApiGit = await azureApi.gitApi();\n const repos = await azureApiGit.getRepositories();\n const repo = getRepoByName(repository, repos);\n if (!repo) {\n logger.error({ repos, repo }, 'Could not find repo in repo list');\n throw new Error(REPOSITORY_NOT_FOUND);\n }\n logger.debug({ repositoryDetails: repo }, 'Repository details');\n if (repo.isDisabled) {\n logger.debug('Repository is disabled- throwing error to abort renovation');\n throw new Error(REPOSITORY_ARCHIVED);\n }\n /* v8 ignore next -- defensive: Azure omits defaultBranch only for empty repos, which abort earlier in specs */\n if (!repo.defaultBranch) {\n logger.debug('Repo is empty');\n throw new Error(REPOSITORY_EMPTY);\n }\n // TODO #22198\n config.repoId = repo.id!;\n\n config.project = repo.project!.name!;\n config.projectId = repo.project!.id!;\n config.workItemType = azureWorkItemType ?? getConfig().azureWorkItemType!;\n issueService = new IssueService(config);\n config.owner = '?owner?';\n logger.debug(`${repository} owner = ${config.owner}`);\n const defaultBranch = repo.defaultBranch.replace('refs/heads/', '');\n config.defaultBranch = defaultBranch;\n logger.debug(`${repository} default branch = ${defaultBranch}`);\n config.mergeMethods = {};\n config.repoForceRebase = false;\n\n const [projectName, repoName] = repository.split('/');\n const opts = hostRules.find({\n hostType: defaults.hostType,\n url: defaults.endpoint,\n });\n // TODO: types (#22198)\n const manualUrl = `${defaults.endpoint!}${encodeURIComponent(\n projectName,\n )}/_git/${encodeURIComponent(repoName)}`;\n const url = repo.remoteUrl ?? manualUrl;\n await git.initRepo({\n ...config,\n url,\n extraCloneOpts: getStorageExtraCloneOpts(opts),\n cloneSubmodules,\n cloneSubmodulesFilter,\n });\n const repoConfig: RepoResult = {\n defaultBranch,\n isFork: false,\n repoFingerprint: repoFingerprint(repo.id!, defaults.endpoint),\n };\n return repoConfig;\n}\n\nexport async function getPrList(): Promise<AzurePr[]> {\n logger.debug('getPrList()');\n if (!config.prList) {\n const azureApiGit = await azureApi.gitApi();\n\n let prs: GitPullRequest[] = [];\n let fetchedPrs: GitPullRequest[];\n let skip = 0;\n do {\n fetchedPrs = await getRepoPullRequests({\n gitApi: azureApiGit,\n searchCriteria: {\n status: PullRequestStatus.All,\n // fetch only prs directly created on the repo and not by forks\n sourceRepositoryId: config.repoId,\n ...(!config.ignorePrAuthor &&\n renovateUserId && { creatorId: renovateUserId }),\n },\n skip,\n top: 100,\n });\n prs = prs.concat(fetchedPrs);\n skip += 100;\n } while (fetchedPrs.length > 0);\n\n config.prList = prs.map(getRenovatePRFormat);\n logger.debug(`Retrieved Pull Requests count: ${config.prList.length}`);\n }\n return config.prList;\n}\n\nexport async function getPr(pullRequestId: number): Promise<Pr | null> {\n logger.debug(`getPr(${pullRequestId})`);\n if (!pullRequestId) {\n return null;\n }\n const azurePr = (await getPrList()).find(\n (item) => item.number === pullRequestId,\n );\n\n if (!azurePr) {\n return null;\n }\n\n const azureApiGit = await azureApi.gitApi();\n // the PR list returns descriptions truncated to 400 characters, so read the\n // full one for the body hash\n const { description } = await azureApiGit.getPullRequestById(\n pullRequestId,\n config.project,\n );\n azurePr.bodyStruct = getPrBodyStruct(description);\n\n const labels = await azureApiGit.getPullRequestLabels(\n config.repoId,\n pullRequestId,\n );\n\n azurePr.labels = labels\n .filter((label) => label.active)\n .map((label) => label.name)\n .filter(isString);\n return azurePr;\n}\n\nexport async function findPr({\n branchName,\n prTitle,\n state = 'all',\n targetBranch,\n includeOtherAuthors,\n}: FindPRConfig): Promise<Pr | null> {\n let prsFiltered: Pr[] = [];\n try {\n if (includeOtherAuthors) {\n const azureApiGit = await azureApi.gitApi();\n const [pr] = await getRepoPullRequests({\n gitApi: azureApiGit,\n searchCriteria: {\n sourceRefName: getNewBranchName(branchName),\n sourceRepositoryId: config.repoId,\n status: PullRequestStatus.Active,\n ...(targetBranch && {\n targetRefName: getNewBranchName(targetBranch),\n }),\n },\n skip: 0,\n top: 1,\n });\n return pr ? getRenovatePRFormat(pr) : null;\n }\n\n const prs = await getPrList();\n\n prsFiltered = prs.filter(\n (item) => item.sourceRefName === getNewBranchName(branchName),\n );\n\n if (prTitle) {\n prsFiltered = prsFiltered.filter(\n (item) => item.title.toUpperCase() === prTitle.toUpperCase(),\n );\n }\n\n switch (state) {\n case 'all':\n // no more filter needed, we can go further...\n break;\n case '!open':\n prsFiltered = prsFiltered.filter((item) => item.state !== 'open');\n break;\n default:\n prsFiltered = prsFiltered.filter((item) => item.state === state);\n break;\n }\n } catch (err) {\n logger.error({ err }, 'findPr error');\n }\n if (prsFiltered.length === 0) {\n return null;\n }\n if (targetBranch && prsFiltered.length > 1) {\n const pr = prsFiltered.find((item) => item.targetBranch === targetBranch);\n if (pr) {\n return pr;\n }\n }\n return prsFiltered[0];\n}\n\nexport async function getBranchPr(\n branchName: string,\n targetBranch?: string,\n): Promise<Pr | null> {\n logger.debug(`getBranchPr(${branchName}, ${targetBranch})`);\n const existingPr = await findPr({\n branchName,\n state: 'open',\n targetBranch,\n });\n return existingPr ? getPr(existingPr.number) : null;\n}\n\nasync function getStatusCheck(branchName: string): Promise<GitStatus[]> {\n const azureApiGit = await azureApi.gitApi();\n const branch = await azureApiGit.getBranch(\n config.repoId,\n\n // TODO: fix undefined (#22198)\n getBranchNameWithoutRefsheadsPrefix(branchName)!,\n );\n // only grab the latest statuses, it will group any by context\n return azureApiGit.getStatuses(\n // TODO #22198\n branch.commit!.commitId!,\n config.repoId,\n undefined,\n undefined,\n undefined,\n true,\n );\n}\n\nconst azureToRenovateStatusMapping: Record<GitStatusState, BranchStatus> = {\n [GitStatusState.Succeeded]: 'green',\n [GitStatusState.NotApplicable]: 'green',\n [GitStatusState.NotSet]: 'yellow',\n [GitStatusState.Pending]: 'yellow',\n [GitStatusState.PartiallySucceeded]: 'yellow',\n [GitStatusState.Error]: 'red',\n [GitStatusState.Failed]: 'red',\n};\n\nexport async function getBranchStatusCheck(\n branchName: string,\n context: string,\n): Promise<BranchStatus | null> {\n const res = await getStatusCheck(branchName);\n for (const check of res) {\n if (getGitStatusContextCombinedName(check.context) === context) {\n // TODO #22198\n return azureToRenovateStatusMapping[check.state!] ?? 'yellow';\n }\n }\n return null;\n}\n\nexport async function getBranchStatus(\n branchName: string,\n internalChecksAsSuccess: boolean,\n): Promise<BranchStatus> {\n logger.debug(`getBranchStatus(${branchName})`);\n const statuses = await getStatusCheck(branchName);\n logger.debug({ branch: branchName, statuses }, 'branch status check result');\n if (!statuses.length) {\n logger.debug('empty branch status check result = returning \"pending\"');\n return 'yellow';\n }\n const noOfFailures = statuses.filter(\n (status) =>\n status.state === GitStatusState.Error ||\n status.state === GitStatusState.Failed,\n ).length;\n if (noOfFailures) {\n return 'red';\n }\n const noOfPending = statuses.filter(\n (status) =>\n status.state === GitStatusState.NotSet ||\n status.state === GitStatusState.Pending,\n ).length;\n if (noOfPending) {\n return 'yellow';\n }\n if (\n !internalChecksAsSuccess &&\n statuses.every(\n (status) =>\n status.state === GitStatusState.Succeeded &&\n status.context?.genre === 'renovate',\n )\n ) {\n logger.debug(\n 'Successful checks are all internal renovate/ checks, so returning \"pending\" branch status',\n );\n return 'yellow';\n }\n return 'green';\n}\n\nasync function getMergeStrategy(\n targetRefName: string,\n): Promise<GitPullRequestMergeStrategy> {\n return (\n config.mergeMethods[targetRefName] ??\n (config.mergeMethods[targetRefName] = await azureHelper.getMergeMethod(\n config.repoId,\n config.project,\n targetRefName,\n config.defaultBranch,\n ))\n );\n}\n\nasync function getPendingBlockingPolicyEvaluations(\n pullRequestId: number,\n): Promise<PolicyEvaluationRecord[]> {\n const artifactId = `vstfs:///CodeReview/CodeReviewId/${config.projectId}/${pullRequestId}`;\n const policyEvaluations = await azureHelper.getPolicyEvaluations(\n config.project,\n artifactId,\n );\n logger.debug(\n { pullRequestId, artifactId, policyEvaluations },\n 'Retrieved policy evaluations for PR',\n );\n return policyEvaluations.filter(\n (evaluation) =>\n evaluation.configuration?.isBlocking &&\n evaluation.status !== PolicyEvaluationStatus.Approved &&\n evaluation.status !== PolicyEvaluationStatus.NotApplicable,\n );\n}\n\nasync function setPlatformAutomerge(\n azureApiGit: IGitApi,\n pr: GitPullRequest,\n platformPrOptions: PlatformPrOptions,\n): Promise<GitPullRequest> {\n let mergeStrategy: GitPullRequestMergeStrategy;\n if (platformPrOptions.automergeStrategy === 'auto') {\n mergeStrategy = await getMergeStrategy(pr.targetRefName!);\n } else {\n mergeStrategy = mapMergeStrategy(platformPrOptions.automergeStrategy);\n }\n const prOptions: GitPullRequest = {\n autoCompleteSetBy: {\n // TODO #22198\n id: pr.createdBy!.id,\n },\n completionOptions: {\n mergeStrategy,\n deleteSourceBranch: true,\n mergeCommitMessage: pr.title,\n },\n };\n\n logger.debug(\n {\n prOptions,\n repoId: config.repoId,\n pullRequestId: pr.pullRequestId!,\n },\n // TODO #22198\n `Updating PR ${pr.pullRequestId!} to specify platformAutomerge settings`,\n );\n\n return await azureApiGit.updatePullRequest(\n prOptions,\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n );\n}\n\nexport async function reattemptPlatformAutomerge({\n number,\n platformPrOptions,\n}: ReattemptPlatformAutomergeConfig): Promise<void> {\n try {\n const azureApiGit = await azureApi.gitApi();\n const pr = await azureApiGit.getPullRequestById(number, config.project);\n await setPlatformAutomerge(\n azureApiGit,\n pr,\n coerceObject(platformPrOptions),\n );\n\n logger.debug(`PR platform automerge re-attempted...prNo: ${number}`);\n } catch (err) {\n logger.warn({ err }, 'Error re-attempting PR platform automerge');\n }\n}\n\nexport async function createPr({\n sourceBranch,\n targetBranch,\n prTitle: title,\n prBody: body,\n labels,\n draftPR = false,\n platformPrOptions,\n}: CreatePRConfig): Promise<Pr> {\n const sourceRefName = getNewBranchName(sourceBranch);\n const targetRefName = getNewBranchName(targetBranch);\n const description = max4000Chars(sanitize(body));\n const azureApiGit = await azureApi.gitApi();\n const workItemRefs = [\n {\n id: platformPrOptions?.azureWorkItemId?.toString(),\n },\n ];\n let pr: GitPullRequest = await azureApiGit.createPullRequest(\n {\n sourceRefName,\n targetRefName,\n title,\n description,\n workItemRefs,\n isDraft: draftPR,\n },\n config.repoId,\n );\n if (platformPrOptions?.usePlatformAutomerge) {\n pr = await setPlatformAutomerge(azureApiGit, pr, platformPrOptions);\n }\n if (platformPrOptions?.autoApprove) {\n const approver = {\n reviewerUrl: pr.createdBy!.url,\n vote: AzurePrVote.Approved,\n isFlagged: false,\n isRequired: false,\n };\n\n logger.debug(\n {\n approver,\n\n repoId: config.repoId,\n // TODO #22198\n pullRequestId: pr.pullRequestId!,\n prCreatedBy: {\n id: pr.createdBy!.id!,\n },\n },\n // TODO #22198\n `Auto-approving PR ${pr.pullRequestId!}`,\n );\n\n await azureApiGit.createPullRequestReviewer(\n approver,\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n pr.createdBy!.id!,\n );\n }\n await Promise.all(\n labels!.map((label) =>\n azureApiGit.createPullRequestLabel(\n {\n name: label,\n },\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n ),\n ),\n );\n\n const result = getRenovatePRFormat(pr);\n if (config.prList) {\n config.prList.push(result);\n }\n return result;\n}\n\nexport async function updatePr({\n number: prNo,\n prTitle: title,\n prBody: body,\n state,\n platformPrOptions,\n targetBranch,\n}: UpdatePrConfig): Promise<void> {\n logger.debug(`updatePr(${prNo}, ${title}, body)`);\n\n const azureApiGit = await azureApi.gitApi();\n const objToUpdate: GitPullRequest = {\n title,\n };\n\n if (targetBranch) {\n objToUpdate.targetRefName = getNewBranchName(targetBranch);\n }\n\n if (body) {\n objToUpdate.description = max4000Chars(sanitize(body));\n }\n\n if (state === 'open') {\n await azureApiGit.updatePullRequest(\n {\n status: PullRequestStatus.Active,\n },\n config.repoId,\n prNo,\n );\n } else if (state === 'closed') {\n objToUpdate.status = PullRequestStatus.Abandoned;\n }\n if (platformPrOptions?.autoApprove) {\n const pr = await azureApiGit.getPullRequestById(prNo, config.project);\n await azureApiGit.createPullRequestReviewer(\n {\n reviewerUrl: pr.createdBy!.url,\n vote: AzurePrVote.Approved,\n isFlagged: false,\n isRequired: false,\n },\n config.repoId,\n // TODO #22198\n pr.pullRequestId!,\n pr.createdBy!.id!,\n );\n }\n\n const updatedPr = await azureApiGit.updatePullRequest(\n objToUpdate,\n config.repoId,\n prNo,\n );\n if (config.prList) {\n const prToCache = getRenovatePRFormat(updatedPr);\n // We need to update the cached entry for this PR\n const existingIndex = config.prList.findIndex(\n (item) => item.number === prNo,\n );\n /* v8 ignore next: should not happen */\n if (existingIndex === -1) {\n logger.warn({ prNo }, 'PR not found in cache');\n // Add to cache\n config.prList.push(prToCache);\n } else {\n // overwrite existing PR in cache\n config.prList[existingIndex] = prToCache;\n }\n }\n}\n\nexport async function ensureComment({\n number,\n topic,\n content,\n}: EnsureCommentConfig): Promise<boolean> {\n logger.debug(`ensureComment(${number}, ${topic!}, content)`);\n const header = topic ? `### ${topic}\\n\\n` : '';\n const body = `${header}${sanitize(massageMarkdown(content))}`;\n const azureApiGit = await azureApi.gitApi();\n\n const threads = await azureApiGit.getThreads(config.repoId, number);\n let threadIdFound: number | undefined;\n let commentIdFound: number | undefined;\n let commentNeedsUpdating = false;\n threads.forEach((thread) => {\n const firstCommentContent = thread.comments?.[0].content;\n if (\n (topic && firstCommentContent?.startsWith(header)) === true ||\n (!topic && firstCommentContent === body)\n ) {\n threadIdFound = thread.id;\n commentIdFound = thread.comments?.[0].id;\n commentNeedsUpdating = firstCommentContent !== body;\n }\n });\n\n if (!threadIdFound) {\n await azureApiGit.createThread(\n {\n comments: [{ content: body, commentType: 1, parentCommentId: 0 }],\n status: 1,\n },\n config.repoId,\n number,\n );\n logger.info(\n { repository: config.repository, issueNo: number, topic },\n 'Comment added',\n );\n } else if (commentNeedsUpdating) {\n await azureApiGit.updateComment(\n {\n content: body,\n },\n config.repoId,\n number,\n threadIdFound,\n // TODO #22198\n commentIdFound!,\n );\n logger.debug(\n { repository: config.repository, issueNo: number, topic },\n 'Comment updated',\n );\n } else {\n logger.debug(\n { repository: config.repository, issueNo: number, topic },\n 'Comment is already up-to-date',\n );\n }\n\n return true;\n}\n\nexport async function ensureCommentRemoval(\n removeConfig: EnsureCommentRemovalConfig,\n): Promise<void> {\n const { number: issueNo } = removeConfig;\n const key =\n removeConfig.type === 'by-topic'\n ? removeConfig.topic\n : removeConfig.content;\n logger.debug(`Ensuring comment \"${key}\" in #${issueNo} is removed`);\n\n const azureApiGit = await azureApi.gitApi();\n const threads = await azureApiGit.getThreads(config.repoId, issueNo);\n\n let threadIdFound: number | null | undefined = null;\n if (removeConfig.type === 'by-topic') {\n const thread = threads.find(\n (thread: GitPullRequestCommentThread): boolean =>\n !!thread.comments?.[0].content?.startsWith(\n `### ${removeConfig.topic}\\n\\n`,\n ),\n );\n threadIdFound = thread?.id;\n } else {\n const thread = threads.find(\n (thread: GitPullRequestCommentThread): boolean =>\n thread.comments?.[0].content?.trim() === removeConfig.content,\n );\n threadIdFound = thread?.id;\n }\n\n if (threadIdFound) {\n await azureApiGit.updateThread(\n {\n status: 4, // close\n },\n config.repoId,\n issueNo,\n threadIdFound,\n );\n }\n}\n\nconst renovateToAzureStatusMapping: Record<BranchStatus, GitStatusState> = {\n ['green']: GitStatusState.Succeeded,\n ['yellow']: GitStatusState.Pending,\n ['red']: GitStatusState.Failed,\n};\n\nexport async function setBranchStatus({\n branchName,\n context,\n description,\n state,\n url: targetUrl,\n}: BranchStatusConfig): Promise<void> {\n logger.debug(\n `setBranchStatus(${branchName}, ${context}, ${description}, ${state}, ${targetUrl!})`,\n );\n const azureApiGit = await azureApi.gitApi();\n const branch = await azureApiGit.getBranch(\n config.repoId,\n getBranchNameWithoutRefsheadsPrefix(branchName)!,\n );\n const statusToCreate: GitStatus = {\n description,\n context: getGitStatusContextFromCombinedName(context),\n state: renovateToAzureStatusMapping[state],\n targetUrl,\n };\n await azureApiGit.createCommitStatus(\n statusToCreate,\n // TODO #22198\n branch.commit!.commitId!,\n config.repoId,\n );\n logger.trace(`Created commit status of ${state} on branch ${branchName}`);\n}\n\nexport async function mergePr({\n branchName,\n id: pullRequestId,\n strategy,\n}: MergePRConfig): Promise<boolean> {\n logger.debug(`mergePr(${pullRequestId}, ${branchName!})`);\n\n const pendingPolicyEvaluations =\n await getPendingBlockingPolicyEvaluations(pullRequestId);\n if (pendingPolicyEvaluations.length) {\n logger.debug(\n {\n pullRequestId,\n pendingPolicies: pendingPolicyEvaluations.map((evaluation) => ({\n name: evaluation.configuration?.type?.displayName,\n status: PolicyEvaluationStatus[evaluation.status!],\n })),\n },\n 'Not completing PR because branch policies have not been satisfied yet',\n );\n return false;\n }\n\n const azureApiGit = await azureApi.gitApi();\n\n let pr = await azureApiGit.getPullRequestById(pullRequestId, config.project);\n\n const mergeStrategy =\n strategy === 'auto'\n ? await getMergeStrategy(pr.targetRefName!)\n : mapMergeStrategy(strategy);\n const objToUpdate: GitPullRequest = {\n status: PullRequestStatus.Completed,\n lastMergeSourceCommit: pr.lastMergeSourceCommit,\n completionOptions: {\n mergeStrategy,\n deleteSourceBranch: true,\n mergeCommitMessage: pr.title,\n },\n };\n\n logger.trace(\n `Updating PR ${pullRequestId} to status ${PullRequestStatus.Completed} (${\n PullRequestStatus[PullRequestStatus.Completed]\n }) with lastMergeSourceCommit ${\n // TODO: types (#22198)\n pr.lastMergeSourceCommit?.commitId\n } using mergeStrategy ${mergeStrategy} (${\n GitPullRequestMergeStrategy[mergeStrategy]\n })`,\n );\n\n try {\n const response = await azureApiGit.updatePullRequest(\n objToUpdate,\n config.repoId,\n pullRequestId,\n );\n\n let retries = 0;\n let isClosed = response.status === PullRequestStatus.Completed;\n while (!isClosed && retries < 5) {\n retries += 1;\n const sleepMs = retries * 1000;\n logger.trace(\n { pullRequestId, status: pr.status, retries },\n `Updated PR to closed status but change has not taken effect yet. Retrying...`,\n );\n\n await setTimeout(sleepMs);\n pr = await azureApiGit.getPullRequestById(pullRequestId, config.project);\n isClosed = pr.status === PullRequestStatus.Completed;\n }\n\n if (!isClosed) {\n logger.warn(\n {\n pullRequestId,\n status: pr.status,\n expectedPRStatus: PullRequestStatus[PullRequestStatus.Completed],\n actualPRStatus: PullRequestStatus[pr.status!],\n },\n 'Expected PR to have completed status. However, the PR has a different status',\n );\n }\n return true;\n } catch (err) {\n logger.debug({ err }, 'Failed to set the PR as completed.');\n return false;\n }\n}\n\nexport function massageMarkdown(input: string): string {\n // Remove any HTML we use\n return (\n smartTruncate(readOnlyIssueBody(input), maxBodyLength())\n .replace(\n 'you tick the rebase/retry checkbox',\n 'PR is renamed to start with \"rebase!\"',\n )\n .replace(\n 'checking the rebase/retry box above',\n 'renaming the PR to start with \"rebase!\"',\n )\n .replace(regEx(`\\n---\\n\\n.*?<!-- rebase-check -->.*?\\n`), '')\n .replace(regEx(/<!--renovate-(?:debug|config-hash):.*?-->/g), '')\n // Replace GitHub-style PR links with Azure DevOps format\n .replace(regEx(/\\]\\(\\.\\.\\/pull\\//g), '](!')\n // Replace GitHub-style PR references (#123) with Azure DevOps format, needed for text linking config migration PR.\n // Only match a standalone reference (preceded by start, whitespace or `(`) so we don't corrupt\n // HTML entities like `​` or URL anchors like `CHANGELOG.md#4780`.\n .replace(regEx(/(?<lead>^|[\\s(])#(?<num>\\d+)/g), '$<lead>!$<num>')\n );\n}\n\nexport function maxBodyLength(): number {\n return 4000;\n}\n\nexport async function findIssue(title: string): Promise<Issue | null> {\n return await issueService.findIssue(title);\n}\n\nexport async function ensureIssue(\n issueConfig: EnsureIssueConfig,\n): Promise<EnsureIssueResult | null> {\n return await issueService.ensureIssue(issueConfig);\n}\n\nexport async function ensureIssueClosing(title: string): Promise<void> {\n return await issueService.ensureIssueClosing(title);\n}\n\nexport async function getIssueList(titleFilter?: string): Promise<Issue[]> {\n return await issueService.getIssueList(titleFilter);\n}\n\nasync function getUserIds(users: string[]): Promise<User[]> {\n const azureApiGit = await azureApi.gitApi();\n const azureApiCore = await azureApi.coreApi();\n const repos = await azureApiGit.getRepositories();\n const repo = repos.find((c) => c.id === config.repoId)!;\n const requiredReviewerPrefix = 'required:';\n const validReviewers = new Set<string>();\n\n // TODO #22198\n const teams = await azureHelper.getAllProjectTeams(repo.project!.id!);\n const members = await Promise.all(\n teams.map(\n async (t) =>\n await azureApiCore.getTeamMembersWithExtendedProperties(\n // TODO #22198\n repo.project!.id!,\n t.id!,\n ),\n ),\n );\n\n const ids: { id: string; name: string; isRequired: boolean }[] = [];\n members.forEach((listMembers) => {\n listMembers.forEach((m) => {\n users.forEach((r) => {\n let reviewer = r;\n let isRequired = false;\n if (reviewer.startsWith(requiredReviewerPrefix)) {\n reviewer = reviewer.replace(requiredReviewerPrefix, '');\n isRequired = true;\n }\n if (\n (reviewer.toLowerCase() === m.identity?.displayName?.toLowerCase() ||\n reviewer.toLowerCase() === m.identity?.uniqueName?.toLowerCase()) &&\n ids.filter((c) => c.id === m.identity?.id).length === 0\n ) {\n // TODO #22198\n ids.push({\n id: m.identity.id!,\n name: reviewer,\n isRequired,\n });\n\n validReviewers.add(reviewer);\n }\n });\n });\n });\n\n teams.forEach((t) => {\n users.forEach((r) => {\n let reviewer = r;\n let isRequired = false;\n if (reviewer.startsWith(requiredReviewerPrefix)) {\n reviewer = reviewer.replace(requiredReviewerPrefix, '');\n isRequired = true;\n }\n // v8 ignore else -- TODO: add test #40625\n if (\n reviewer.toLowerCase() === t.name?.toLowerCase() &&\n ids.filter((c) => c.id === t.id).length === 0\n ) {\n // TODO #22198\n ids.push({ id: t.id!, name: reviewer, isRequired });\n\n validReviewers.add(reviewer);\n }\n });\n });\n\n for (const u of users) {\n const reviewer = u.replace(requiredReviewerPrefix, '');\n if (!validReviewers.has(reviewer)) {\n logger.once.info(\n `${reviewer} is neither an Azure DevOps Team nor a user associated with a Team`,\n );\n }\n }\n\n return ids;\n}\n\n/**\n *\n * @param {number} issueNo\n * @param {string[]} assignees\n */\nexport async function addAssignees(\n issueNo: number,\n assignees: string[],\n): Promise<void> {\n logger.trace(`addAssignees(${issueNo}, [${assignees.join(', ')}])`);\n const ids = await getUserIds(assignees);\n await ensureComment({\n number: issueNo,\n topic: 'Add Assignees',\n content: ids.map((a) => `@<${a.id}>`).join(', '),\n });\n}\n\n/**\n *\n * @param {number} prNo\n * @param {string[]} reviewers\n */\nexport async function addReviewers(\n prNo: number,\n reviewers: string[],\n): Promise<void> {\n logger.trace(`addReviewers(${prNo}, [${reviewers.join(', ')}])`);\n const azureApiGit = await azureApi.gitApi();\n\n const ids = await getUserIds(reviewers);\n\n await Promise.all(\n ids.map(async (obj) => {\n await azureApiGit.createPullRequestReviewer(\n {\n isRequired: obj.isRequired,\n },\n config.repoId,\n prNo,\n obj.id,\n );\n logger.debug(`Reviewer added: ${obj.name}`);\n }),\n );\n}\n\nexport async function deleteLabel(\n prNumber: number,\n label: string,\n): Promise<void> {\n logger.debug(`Deleting label ${label} from #${prNumber}`);\n const azureApiGit = await azureApi.gitApi();\n await azureApiGit.deletePullRequestLabels(config.repoId, prNumber, label);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,IAAI,SAAiB,CAAC;AACtB,IAAI;AACJ,IAAI;AAEJ,MAAM,WAGF,EACF,UAAU,QACZ;AAEA,SAAS,oBAAoB,EAC3B,QACA,gBACA,MACA,OACwD;CAExD,OAAO,OAAO,gBACZ,OAAO,QACP,gBACA,OAAO,SACP,GACA,MACA,GACF;AACF;AAEA,MAAa,KAAK;AAElB,SAAgB,aAAa,EAC3B,UACA,OACA,UACA,YAC0C;CAC1C,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,IAAI,CAAC,SAAS,EAAE,YAAY,WAC1B,MAAM,IAAI,MACR,4EACF;CAGF,MAAM,MAAM,EACV,UAAU,oBAAoB,QAAQ,EACxC;CACA,SAAS,WAAW,IAAI;CACxB,YAAqB,IAAI,QAAQ;CAIjC,OAAOA,uBAHa,QAChB,EAAE,MAAM,IACR;EAAY;EAAqB;CAAU,CACG,CAAC,CAAC,MAAM,WAAW;EACnE,iBAAiB;EACjB,OAAO;CACT,CAAC;AACH;AAEA,eAAsB,WAA8B;CAClD,OAAO,MAAM,2CAA2C;CAGxD,QAAO,OADa,MADMC,OAAgB,EAA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KAAK,MAAM;KAAU;IAAW,CAAC;IAElD,eAAe,IAAI,QAAQ;GAC7B;EACF,CAAC;CACH,CAAC;CAED,KAAK,MAAM,KAAK,OAAO;EACrB,MAAM,WAAW,EAAE,QAAQ,wBAAwB,EAAE;EACrD,IAAI,CAAC,eAAe,IAAI,QAAQ,GAC9B,OAAO,KAAK,KACV,GAAG,SAAS,mEACd;CAEJ;CAEA,OAAO;AACT;;;;;;AAOA,eAAsB,aACpB,SACA,WACe;CACf,OAAO,MAAM,gBAAgB,QAAQ,KAAK,UAAU,KAAK,IAAI,EAAE,GAAG;CAElE,MAAM,cAAc;EAClB,QAAQ;EACR,OAAO;EACP,UAAS,MAJO,WAAW,SAAS,EAAA,CAIvB,KAAK,MAAM,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI;CACjD,CAAC;AACH;;;;;;AAOA,eAAsB,aACpB,MACA,WACe;CACf,OAAO,MAAM,gBAAgB,KAAK,KAAK,UAAU,KAAK,IAAI,EAAE,GAAG;CAC/D,MAAM,cAAc,MAAMN,OAAgB;CAE1C,MAAM,MAAM,MAAM,WAAW,SAAS;CAEtC,MAAM,QAAQ,IACZ,IAAI,IAAI,OAAO,QAAQ;EACrB,MAAM,YAAY,0BAChB,EACE,YAAY,IAAI,WAClB,GACA,OAAO,QACP,MACA,IAAI,EACN;EACA,OAAO,MAAM,mBAAmB,IAAI,MAAM;CAC5C,CAAC,CACH;AACF;AAEA,eAAsB,YACpB,UACA,OACe;CACf,OAAO,MAAM,kBAAkB,MAAM,SAAS,UAAU;CAExD,OAAM,MADoBA,OAAgB,EAAA,CACxB,wBAAwB,OAAO,QAAQ,UAAU,KAAK;AAC1E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PlatformId } from "../../constants/platforms.js";
|
|
2
|
-
import { AutodiscoverConfig, BranchStatusConfig, CreatePRConfig, EnsureCommentConfig, EnsureCommentRemovalConfig, EnsureCommentRemovalConfigByContent, EnsureCommentRemovalConfigByTopic, EnsureIssueConfig, EnsureIssueResult, FileOwnerRule, FindPRConfig, GitUrlOption, Issue, MergePRConfig, Platform, PlatformParams, PlatformPrOptions, PlatformResult, PlatformScm, Pr, PrBodyStruct, PrDebugData, ReattemptPlatformAutomergeConfig, RepoParams, RepoResult, RepoSortMethod, SortMethod, StatusCheckConfig, UpdatePrConfig, VulnerabilityAlert } from "./types.js";
|
|
2
|
+
import { AutodiscoverConfig, BranchStatusConfig, CreatePRConfig, EnsureCommentConfig, EnsureCommentRemovalConfig, EnsureCommentRemovalConfigByContent, EnsureCommentRemovalConfigByTopic, EnsureIssueConfig, EnsureIssueResult, FileOwnerRule, FindPRConfig, GitUrlOption, Issue, MergePRConfig, Platform, PlatformParams, PlatformPrOptions, PlatformResult, PlatformScm, Pr, PrBodyStruct, PrDebugData, ReattemptPlatformAutomergeConfig, RepoConfigParams, RepoParams, RepoResult, RepoSortMethod, SortMethod, StatusCheckConfig, UpdatePrConfig, VulnerabilityAlert } from "./types.js";
|
|
3
3
|
import { AllConfig } from "../../config/types.js";
|
|
4
4
|
//#region lib/modules/platform/index.d.ts
|
|
5
5
|
export declare function getPlatformList(): string[];
|
|
@@ -7,5 +7,5 @@ export declare const platform: Platform;
|
|
|
7
7
|
export declare function setPlatformApi(name: PlatformId): void;
|
|
8
8
|
export declare function initPlatform(config: AllConfig): Promise<AllConfig>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export type { AutodiscoverConfig, BranchStatusConfig, CreatePRConfig, EnsureCommentConfig, EnsureCommentRemovalConfig, EnsureCommentRemovalConfigByContent, EnsureCommentRemovalConfigByTopic, EnsureIssueConfig, EnsureIssueResult, FileOwnerRule, FindPRConfig, GitUrlOption, Issue, MergePRConfig, Platform, PlatformParams, PlatformPrOptions, PlatformResult, PlatformScm, Pr, PrBodyStruct, PrDebugData, ReattemptPlatformAutomergeConfig, RepoParams, RepoResult, RepoSortMethod, SortMethod, StatusCheckConfig, UpdatePrConfig, VulnerabilityAlert };
|
|
10
|
+
export type { AutodiscoverConfig, BranchStatusConfig, CreatePRConfig, EnsureCommentConfig, EnsureCommentRemovalConfig, EnsureCommentRemovalConfigByContent, EnsureCommentRemovalConfigByTopic, EnsureIssueConfig, EnsureIssueResult, FileOwnerRule, FindPRConfig, GitUrlOption, Issue, MergePRConfig, Platform, PlatformParams, PlatformPrOptions, PlatformResult, PlatformScm, Pr, PrBodyStruct, PrDebugData, ReattemptPlatformAutomergeConfig, RepoConfigParams, RepoParams, RepoResult, RepoSortMethod, SortMethod, StatusCheckConfig, UpdatePrConfig, VulnerabilityAlert };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -42,6 +42,10 @@ export interface RepoParams {
|
|
|
42
42
|
/** Azure only: work item type to use when creating issues. */
|
|
43
43
|
azureWorkItemType?: string;
|
|
44
44
|
}
|
|
45
|
+
export interface RepoConfigParams {
|
|
46
|
+
/** Azure only: work item type to use when creating issues. */
|
|
47
|
+
azureWorkItemType?: string;
|
|
48
|
+
}
|
|
45
49
|
export interface PrDebugData {
|
|
46
50
|
createdInVer: string;
|
|
47
51
|
updatedInVer: string;
|
|
@@ -208,6 +212,8 @@ export interface Platform {
|
|
|
208
212
|
* Experimental features might be changed or even removed at any time.
|
|
209
213
|
*/
|
|
210
214
|
experimental?: true;
|
|
215
|
+
/** Applies options read from the repository config after `initRepo`. */
|
|
216
|
+
applyRepoConfig?(config: RepoConfigParams): void;
|
|
211
217
|
findIssue(title: string): Promise<Issue | null>;
|
|
212
218
|
getIssueList(): Promise<Issue[]>;
|
|
213
219
|
getIssue?(number: number, memCache?: boolean): Promise<Issue | null>;
|
|
@@ -43,6 +43,7 @@ async function initRepo(config_) {
|
|
|
43
43
|
config = await initApis(config);
|
|
44
44
|
await initializeCaches(config);
|
|
45
45
|
config = await getRepoConfig(config);
|
|
46
|
+
platform.applyRepoConfig?.(config);
|
|
46
47
|
setRepositoryLogLevelRemaps(config.logLevelRemap);
|
|
47
48
|
if (config.mode === "silent") logger.info("Repository is running with mode=silent and will not make Issues or PRs by default");
|
|
48
49
|
checkIfConfigured(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/workers/repository/init/index.ts"],"sourcesContent":["import { GlobalConfig } from '../../../config/global.ts';\nimport { applySecretsAndVariablesToConfig } from '../../../config/secrets.ts';\nimport type { RenovateConfig } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { setRepositoryLogLevelRemaps } from '../../../logger/remap.ts';\nimport { platform } from '../../../modules/platform/index.ts';\nimport * as memCache from '../../../util/cache/memory/index.ts';\nimport { clone } from '../../../util/clone.ts';\nimport { cloneSubmodules, setUserRepoConfig } from '../../../util/git/index.ts';\nimport { getAll } from '../../../util/host-rules.ts';\nimport { initMutexes } from '../../../util/mutex.ts';\nimport { checkIfConfigured } from '../configured.ts';\nimport { PackageFiles } from '../package-files.ts';\nimport type { WorkerPlatformConfig } from './apis.ts';\nimport { initApis } from './apis.ts';\nimport { initializeCaches, resetCaches } from './cache.ts';\nimport { getRepoConfig } from './config.ts';\nimport { detectVulnerabilityAlerts } from './vulnerability.ts';\n\nfunction initializeConfig(config: RenovateConfig): RenovateConfig {\n return {\n ...clone(config),\n errors: [],\n warnings: [],\n branchList: [],\n };\n}\n\nfunction warnOnUnsupportedOptions(config: RenovateConfig): void {\n if (config.filterUnavailableUsers && !platform.filterUnavailableUsers) {\n const platform = GlobalConfig.get('platform');\n logger.warn(\n { platform },\n `Configuration option 'filterUnavailableUsers' is not supported on the current platform.`,\n );\n }\n\n if (config.expandCodeOwnersGroups && !platform.expandGroupMembers) {\n const platform = GlobalConfig.get('platform');\n logger.warn(\n { platform },\n `Configuration option 'expandCodeOwnersGroups' is not supported on the current platform.`,\n );\n }\n}\n\nexport async function initRepo(\n config_: RenovateConfig,\n): Promise<RenovateConfig> {\n PackageFiles.clear();\n let config: RenovateConfig = initializeConfig(config_);\n await resetCaches();\n logger.once.reset();\n memCache.init();\n initMutexes();\n config = await initApis(config);\n await initializeCaches(config as WorkerPlatformConfig);\n config = await getRepoConfig(config);\n setRepositoryLogLevelRemaps(config.logLevelRemap);\n if (config.mode === 'silent') {\n logger.info(\n 'Repository is running with mode=silent and will not make Issues or PRs by default',\n );\n }\n checkIfConfigured(config);\n warnOnUnsupportedOptions(config);\n config = applySecretsAndVariablesToConfig({\n config,\n });\n setUserRepoConfig(config);\n config = await detectVulnerabilityAlerts(config);\n // istanbul ignore if\n if (config.printConfig) {\n logger.info(\n { config, hostRules: getAll() },\n 'Full resolved config and hostRules including presets',\n );\n }\n await cloneSubmodules(!!config.cloneSubmodules, config.cloneSubmodulesFilter);\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAS,iBAAiB,QAAwC;CAChE,OAAO;EACL,GAAG,MAAM,MAAM;EACf,QAAQ,CAAC;EACT,UAAU,CAAC;EACX,YAAY,CAAC;CACf;AACF;AAEA,SAAS,yBAAyB,QAA8B;CAC9D,IAAI,OAAO,0BAA0B,CAAC,SAAS,wBAAwB;EACrE,MAAM,WAAW,aAAa,IAAI,UAAU;EAC5C,OAAO,KACL,EAAE,SAAS,GACX,yFACF;CACF;CAEA,IAAI,OAAO,0BAA0B,CAAC,SAAS,oBAAoB;EACjE,MAAM,WAAW,aAAa,IAAI,UAAU;EAC5C,OAAO,KACL,EAAE,SAAS,GACX,yFACF;CACF;AACF;AAEA,eAAsB,SACpB,SACyB;CACzB,aAAa,MAAM;CACnB,IAAI,SAAyB,iBAAiB,OAAO;CACrD,MAAM,YAAY;CAClB,OAAO,KAAK,MAAM;CAClB,KAAc;CACd,YAAY;CACZ,SAAS,MAAM,SAAS,MAAM;CAC9B,MAAM,iBAAiB,MAA8B;CACrD,SAAS,MAAM,cAAc,MAAM;CACnC,4BAA4B,OAAO,aAAa;CAChD,IAAI,OAAO,SAAS,UAClB,OAAO,KACL,mFACF;CAEF,kBAAkB,MAAM;CACxB,yBAAyB,MAAM;CAC/B,SAAS,iCAAiC,EACxC,OACF,CAAC;CACD,kBAAkB,MAAM;CACxB,SAAS,MAAM,0BAA0B,MAAM;;CAE/C,IAAI,OAAO,aACT,OAAO,KACL;EAAE;EAAQ,WAAW,OAAO;CAAE,GAC9B,sDACF;CAEF,MAAM,gBAAgB,CAAC,CAAC,OAAO,iBAAiB,OAAO,qBAAqB;CAC5E,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/workers/repository/init/index.ts"],"sourcesContent":["import { GlobalConfig } from '../../../config/global.ts';\nimport { applySecretsAndVariablesToConfig } from '../../../config/secrets.ts';\nimport type { RenovateConfig } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { setRepositoryLogLevelRemaps } from '../../../logger/remap.ts';\nimport { platform } from '../../../modules/platform/index.ts';\nimport * as memCache from '../../../util/cache/memory/index.ts';\nimport { clone } from '../../../util/clone.ts';\nimport { cloneSubmodules, setUserRepoConfig } from '../../../util/git/index.ts';\nimport { getAll } from '../../../util/host-rules.ts';\nimport { initMutexes } from '../../../util/mutex.ts';\nimport { checkIfConfigured } from '../configured.ts';\nimport { PackageFiles } from '../package-files.ts';\nimport type { WorkerPlatformConfig } from './apis.ts';\nimport { initApis } from './apis.ts';\nimport { initializeCaches, resetCaches } from './cache.ts';\nimport { getRepoConfig } from './config.ts';\nimport { detectVulnerabilityAlerts } from './vulnerability.ts';\n\nfunction initializeConfig(config: RenovateConfig): RenovateConfig {\n return {\n ...clone(config),\n errors: [],\n warnings: [],\n branchList: [],\n };\n}\n\nfunction warnOnUnsupportedOptions(config: RenovateConfig): void {\n if (config.filterUnavailableUsers && !platform.filterUnavailableUsers) {\n const platform = GlobalConfig.get('platform');\n logger.warn(\n { platform },\n `Configuration option 'filterUnavailableUsers' is not supported on the current platform.`,\n );\n }\n\n if (config.expandCodeOwnersGroups && !platform.expandGroupMembers) {\n const platform = GlobalConfig.get('platform');\n logger.warn(\n { platform },\n `Configuration option 'expandCodeOwnersGroups' is not supported on the current platform.`,\n );\n }\n}\n\nexport async function initRepo(\n config_: RenovateConfig,\n): Promise<RenovateConfig> {\n PackageFiles.clear();\n let config: RenovateConfig = initializeConfig(config_);\n await resetCaches();\n logger.once.reset();\n memCache.init();\n initMutexes();\n config = await initApis(config);\n await initializeCaches(config as WorkerPlatformConfig);\n config = await getRepoConfig(config);\n platform.applyRepoConfig?.(config);\n setRepositoryLogLevelRemaps(config.logLevelRemap);\n if (config.mode === 'silent') {\n logger.info(\n 'Repository is running with mode=silent and will not make Issues or PRs by default',\n );\n }\n checkIfConfigured(config);\n warnOnUnsupportedOptions(config);\n config = applySecretsAndVariablesToConfig({\n config,\n });\n setUserRepoConfig(config);\n config = await detectVulnerabilityAlerts(config);\n // istanbul ignore if\n if (config.printConfig) {\n logger.info(\n { config, hostRules: getAll() },\n 'Full resolved config and hostRules including presets',\n );\n }\n await cloneSubmodules(!!config.cloneSubmodules, config.cloneSubmodulesFilter);\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAS,iBAAiB,QAAwC;CAChE,OAAO;EACL,GAAG,MAAM,MAAM;EACf,QAAQ,CAAC;EACT,UAAU,CAAC;EACX,YAAY,CAAC;CACf;AACF;AAEA,SAAS,yBAAyB,QAA8B;CAC9D,IAAI,OAAO,0BAA0B,CAAC,SAAS,wBAAwB;EACrE,MAAM,WAAW,aAAa,IAAI,UAAU;EAC5C,OAAO,KACL,EAAE,SAAS,GACX,yFACF;CACF;CAEA,IAAI,OAAO,0BAA0B,CAAC,SAAS,oBAAoB;EACjE,MAAM,WAAW,aAAa,IAAI,UAAU;EAC5C,OAAO,KACL,EAAE,SAAS,GACX,yFACF;CACF;AACF;AAEA,eAAsB,SACpB,SACyB;CACzB,aAAa,MAAM;CACnB,IAAI,SAAyB,iBAAiB,OAAO;CACrD,MAAM,YAAY;CAClB,OAAO,KAAK,MAAM;CAClB,KAAc;CACd,YAAY;CACZ,SAAS,MAAM,SAAS,MAAM;CAC9B,MAAM,iBAAiB,MAA8B;CACrD,SAAS,MAAM,cAAc,MAAM;CACnC,SAAS,kBAAkB,MAAM;CACjC,4BAA4B,OAAO,aAAa;CAChD,IAAI,OAAO,SAAS,UAClB,OAAO,KACL,mFACF;CAEF,kBAAkB,MAAM;CACxB,yBAAyB,MAAM;CAC/B,SAAS,iCAAiC,EACxC,OACF,CAAC;CACD,kBAAkB,MAAM;CACxB,SAAS,MAAM,0BAA0B,MAAM;;CAE/C,IAAI,OAAO,aACT,OAAO,KACL;EAAE;EAAQ,WAAW,OAAO;CAAE,GAC9B,sDACF;CAEF,MAAM,gBAAgB,CAAC,CAAC,OAAO,iBAAiB,OAAO,qBAAqB;CAC5E,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renovate",
|
|
3
3
|
"description": "Automated dependency updates. Flexible so you don't need to be.",
|
|
4
|
-
"version": "44.168.
|
|
4
|
+
"version": "44.168.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"renovate": "dist/renovate.js",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"commander": "15.0.0",
|
|
142
142
|
"common-tags": "1.8.2",
|
|
143
143
|
"croner": "10.0.1",
|
|
144
|
-
"cronstrue": "3.
|
|
144
|
+
"cronstrue": "3.32.0",
|
|
145
145
|
"deepmerge": "4.3.1",
|
|
146
146
|
"dequal": "2.0.3",
|
|
147
147
|
"detect-indent": "7.0.2",
|
package/renovate-schema.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"title": "JSON schema for Renovate 44.168.
|
|
3
|
+
"title": "JSON schema for Renovate 44.168.3 config files (https://renovatebot.com/)",
|
|
4
4
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"x-renovate-version": "44.168.
|
|
5
|
+
"x-renovate-version": "44.168.3",
|
|
6
6
|
"allowComments": true,
|
|
7
7
|
"type": "object",
|
|
8
8
|
"definitions": {
|