renovate 44.32.1 → 44.32.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/datasource/go/index.js +1 -1
- package/dist/modules/datasource/go/index.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +65 -2
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/pypi/index.js +10 -3
- package/dist/modules/datasource/pypi/index.js.map +1 -1
- package/dist/modules/manager/fingerprint.generated.js +1 -1
- package/dist/modules/manager/fingerprint.generated.js.map +1 -1
- package/dist/modules/platform/github/index.js +1 -1
- package/dist/modules/platform/github/index.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -27,7 +27,7 @@ var GoDatasource = class GoDatasource extends Datasource {
|
|
|
27
27
|
defaultConfig = { commitMessageTopic: "module {{depName}}" };
|
|
28
28
|
customRegistrySupport = false;
|
|
29
29
|
releaseTimestampSupport = true;
|
|
30
|
-
releaseTimestampNote = "If the release timestamp is not returned from the respective datasoure used to fetch the releases, then Renovate uses the `Time` field in the results instead.";
|
|
30
|
+
releaseTimestampNote = "If the release timestamp is not returned from the respective datasoure used to fetch the releases, then Renovate uses the `Time` field in the results instead. For modules hosted on GitHub, a later GitHub Release publication time takes precedence over both.";
|
|
31
31
|
sourceUrlSupport = "package";
|
|
32
32
|
sourceUrlNote = "The source URL is determined from the `packageName` and `registryUrl`.";
|
|
33
33
|
goproxy = new GoProxyDatasource();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["semverId"],"sources":["../../../../lib/modules/datasource/go/index.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport { logger } from '../../../logger/index.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { addSecretForSanitizing } from '../../../util/sanitize.ts';\nimport { parseUrl } from '../../../util/url.ts';\nimport { id as semverId } from '../../versioning/semver/index.ts';\nimport { BitbucketTagsDatasource } from '../bitbucket-tags/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport { ForgejoTagsDatasource } from '../forgejo-tags/index.ts';\nimport { GitTagsDatasource } from '../git-tags/index.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\nimport { GithubTagsDatasource } from '../github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../gitlab-tags/index.ts';\nimport type {\n DigestConfig,\n GetReleasesConfig,\n ReleaseResult,\n} from '../types.ts';\nimport { BaseGoDatasource } from './base.ts';\nimport { parseGoproxy } from './goproxy-parser.ts';\nimport { GoDirectDatasource } from './releases-direct.ts';\nimport { GoProxyDatasource } from './releases-goproxy.ts';\n\nexport class GoDatasource extends Datasource {\n static readonly id = 'go';\n\n override readonly defaultVersioning = semverId;\n\n constructor() {\n super(GoDatasource.id);\n }\n\n override readonly defaultConfig = {\n commitMessageTopic: 'module {{depName}}',\n };\n\n override readonly customRegistrySupport = false;\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'If the release timestamp is not returned from the respective datasoure used to fetch the releases, then Renovate uses the `Time` field in the results instead.';\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `packageName` and `registryUrl`.';\n\n readonly goproxy = new GoProxyDatasource();\n readonly direct = new GoDirectDatasource();\n\n // Pseudo versions https://go.dev/ref/mod#pseudo-versions\n static readonly pversionRegexp = regEx(\n /v\\d+\\.\\d+\\.\\d+-(?:\\w+\\.)?(?:0\\.)?\\d{14}-(?<digest>[a-f0-9]{12})/,\n );\n\n private _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n return this.goproxy.getReleases(config);\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n const constraintsFilteringKey =\n config.constraintsFiltering && config.constraintsFiltering !== 'none'\n ? `@@${config.constraintsFiltering}`\n : '';\n return withCache(\n {\n namespace: `datasource-${GoDatasource.id}`,\n // TODO: types (#22198)\n key: `getReleases:${config.packageName}@@${constraintsFilteringKey}`,\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n /**\n * go.getDigest\n *\n * This datasource resolves a go module URL into its source repository\n * and then fetches the digest if it is on GitHub.\n *\n * This function will:\n * - Determine the source URL for the module\n * - Call the respective getDigest in github to retrieve the commit hash\n */\n private async _getDigest(\n { packageName }: DigestConfig,\n newValue?: string,\n ): Promise<string | null> {\n if (parseGoproxy().some(({ url }) => url === 'off')) {\n logger.debug(\n `Skip digest fetch for ${packageName} with GOPROXY containing \"off\"`,\n );\n return null;\n }\n\n const source = await BaseGoDatasource.getDatasource(packageName);\n if (!source) {\n return null;\n }\n\n // ignore vX.Y.Z-(0.)? pseudo versions that are used Go Modules - look up default branch instead\n // ignore v0.0.0 versions to fetch the digest of default branch, not the commit of non-existing tag `v0.0.0`\n const tag =\n newValue &&\n !GoDatasource.pversionRegexp.test(newValue) &&\n newValue !== 'v0.0.0'\n ? newValue\n : undefined;\n\n switch (source.datasource) {\n case ForgejoTagsDatasource.id: {\n return this.direct.forgejo.getDigest(source, tag);\n }\n case GitTagsDatasource.id: {\n return this.direct.git.getDigest(source, tag);\n }\n case GiteaTagsDatasource.id: {\n return this.direct.gitea.getDigest(source, tag);\n }\n case GithubTagsDatasource.id: {\n return this.direct.github.getDigest(source, tag);\n }\n case BitbucketTagsDatasource.id: {\n return this.direct.bitbucket.getDigest(source, tag);\n }\n case GitlabTagsDatasource.id: {\n return this.direct.gitlab.getDigest(source, tag);\n }\n /* v8 ignore next 3: can never happen, makes lint happy */\n default: {\n return null;\n }\n }\n }\n\n override getDigest(\n config: DigestConfig,\n newValue?: string,\n ): Promise<string | null> {\n return withCache(\n {\n namespace: `datasource-${GoDatasource.id}`,\n key: `getDigest:${config.packageName}:${newValue}`,\n fallback: true,\n },\n () => this._getDigest(config, newValue),\n );\n }\n}\n\nconst env = getEnv();\n/* v8 ignore if -- hard to test */\nif (isString(env.GOPROXY)) {\n const uri = parseUrl(env.GOPROXY);\n if (uri?.password) {\n addSecretForSanitizing(uri.password, 'global');\n } else if (uri?.username) {\n addSecretForSanitizing(uri.username, 'global');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,eAAb,MAAa,qBAAqB,WAAW;CAC3C,OAAgB,KAAK;CAErB,oBAAsCA;CAEtC,cAAc;EACZ,MAAM,aAAa,EAAE;CACvB;CAEA,gBAAkC,EAChC,oBAAoB,qBACtB;CAEA,wBAA0C;CAE1C,0BAA4C;CAC5C,uBACE;CACF,mBAAqC;CACrC,gBACE;CAEF,UAAmB,IAAI,kBAAkB;CACzC,SAAkB,IAAI,mBAAmB;CAGzC,OAAgB,iBAAiB,MAC/B,iEACF;CAEA,aACE,QAC+B;EAC/B,OAAO,KAAK,QAAQ,YAAY,MAAM;CACxC;CAEA,YAAY,QAA0D;EACpE,MAAM,0BACJ,OAAO,wBAAwB,OAAO,yBAAyB,SAC3D,KAAK,OAAO,yBACZ;EACN,OAAO,UACL;GACE,WAAW,cAAc,aAAa;GAEtC,KAAK,eAAe,OAAO,YAAY,IAAI;GAC3C,UAAU;EACZ,SACM,KAAK,aAAa,MAAM,CAChC;CACF;;;;;;;;;;;CAYA,MAAc,WACZ,EAAE,eACF,UACwB;EACxB,IAAI,aAAa,CAAC,CAAC,MAAM,EAAE,UAAU,QAAQ,KAAK,GAAG;GACnD,OAAO,MACL,yBAAyB,YAAY,+BACvC;GACA,OAAO;EACT;EAEA,MAAM,SAAS,MAAM,iBAAiB,cAAc,WAAW;EAC/D,IAAI,CAAC,QACH,OAAO;EAKT,MAAM,MACJ,YACA,CAAC,aAAa,eAAe,KAAK,QAAQ,KAC1C,aAAa,WACT,WACA,KAAA;EAEN,QAAQ,OAAO,YAAf;GACE,KAAK,sBAAsB,IACzB,OAAO,KAAK,OAAO,QAAQ,UAAU,QAAQ,GAAG;GAElD,KAAK,kBAAkB,IACrB,OAAO,KAAK,OAAO,IAAI,UAAU,QAAQ,GAAG;GAE9C,KAAK,oBAAoB,IACvB,OAAO,KAAK,OAAO,MAAM,UAAU,QAAQ,GAAG;GAEhD,KAAK,qBAAqB,IACxB,OAAO,KAAK,OAAO,OAAO,UAAU,QAAQ,GAAG;GAEjD,KAAK,wBAAwB,IAC3B,OAAO,KAAK,OAAO,UAAU,UAAU,QAAQ,GAAG;GAEpD,KAAK,qBAAqB,IACxB,OAAO,KAAK,OAAO,OAAO,UAAU,QAAQ,GAAG;;GAGjD,SACE,OAAO;EAEX;CACF;CAEA,UACE,QACA,UACwB;EACxB,OAAO,UACL;GACE,WAAW,cAAc,aAAa;GACtC,KAAK,aAAa,OAAO,YAAY,GAAG;GACxC,UAAU;EACZ,SACM,KAAK,WAAW,QAAQ,QAAQ,CACxC;CACF;AACF;AAEA,MAAM,MAAM,OAAO;;AAEnB,IAAI,SAAS,IAAI,OAAO,GAAG;CACzB,MAAM,MAAM,SAAS,IAAI,OAAO;CAChC,IAAI,KAAK,UACP,uBAAuB,IAAI,UAAU,QAAQ;MACxC,IAAI,KAAK,UACd,uBAAuB,IAAI,UAAU,QAAQ;AAEjD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["semverId"],"sources":["../../../../lib/modules/datasource/go/index.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport { logger } from '../../../logger/index.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { addSecretForSanitizing } from '../../../util/sanitize.ts';\nimport { parseUrl } from '../../../util/url.ts';\nimport { id as semverId } from '../../versioning/semver/index.ts';\nimport { BitbucketTagsDatasource } from '../bitbucket-tags/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport { ForgejoTagsDatasource } from '../forgejo-tags/index.ts';\nimport { GitTagsDatasource } from '../git-tags/index.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\nimport { GithubTagsDatasource } from '../github-tags/index.ts';\nimport { GitlabTagsDatasource } from '../gitlab-tags/index.ts';\nimport type {\n DigestConfig,\n GetReleasesConfig,\n ReleaseResult,\n} from '../types.ts';\nimport { BaseGoDatasource } from './base.ts';\nimport { parseGoproxy } from './goproxy-parser.ts';\nimport { GoDirectDatasource } from './releases-direct.ts';\nimport { GoProxyDatasource } from './releases-goproxy.ts';\n\nexport class GoDatasource extends Datasource {\n static readonly id = 'go';\n\n override readonly defaultVersioning = semverId;\n\n constructor() {\n super(GoDatasource.id);\n }\n\n override readonly defaultConfig = {\n commitMessageTopic: 'module {{depName}}',\n };\n\n override readonly customRegistrySupport = false;\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'If the release timestamp is not returned from the respective datasoure used to fetch the releases, then Renovate uses the `Time` field in the results instead. For modules hosted on GitHub, a later GitHub Release publication time takes precedence over both.';\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `packageName` and `registryUrl`.';\n\n readonly goproxy = new GoProxyDatasource();\n readonly direct = new GoDirectDatasource();\n\n // Pseudo versions https://go.dev/ref/mod#pseudo-versions\n static readonly pversionRegexp = regEx(\n /v\\d+\\.\\d+\\.\\d+-(?:\\w+\\.)?(?:0\\.)?\\d{14}-(?<digest>[a-f0-9]{12})/,\n );\n\n private _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n return this.goproxy.getReleases(config);\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n const constraintsFilteringKey =\n config.constraintsFiltering && config.constraintsFiltering !== 'none'\n ? `@@${config.constraintsFiltering}`\n : '';\n return withCache(\n {\n namespace: `datasource-${GoDatasource.id}`,\n // TODO: types (#22198)\n key: `getReleases:${config.packageName}@@${constraintsFilteringKey}`,\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n /**\n * go.getDigest\n *\n * This datasource resolves a go module URL into its source repository\n * and then fetches the digest if it is on GitHub.\n *\n * This function will:\n * - Determine the source URL for the module\n * - Call the respective getDigest in github to retrieve the commit hash\n */\n private async _getDigest(\n { packageName }: DigestConfig,\n newValue?: string,\n ): Promise<string | null> {\n if (parseGoproxy().some(({ url }) => url === 'off')) {\n logger.debug(\n `Skip digest fetch for ${packageName} with GOPROXY containing \"off\"`,\n );\n return null;\n }\n\n const source = await BaseGoDatasource.getDatasource(packageName);\n if (!source) {\n return null;\n }\n\n // ignore vX.Y.Z-(0.)? pseudo versions that are used Go Modules - look up default branch instead\n // ignore v0.0.0 versions to fetch the digest of default branch, not the commit of non-existing tag `v0.0.0`\n const tag =\n newValue &&\n !GoDatasource.pversionRegexp.test(newValue) &&\n newValue !== 'v0.0.0'\n ? newValue\n : undefined;\n\n switch (source.datasource) {\n case ForgejoTagsDatasource.id: {\n return this.direct.forgejo.getDigest(source, tag);\n }\n case GitTagsDatasource.id: {\n return this.direct.git.getDigest(source, tag);\n }\n case GiteaTagsDatasource.id: {\n return this.direct.gitea.getDigest(source, tag);\n }\n case GithubTagsDatasource.id: {\n return this.direct.github.getDigest(source, tag);\n }\n case BitbucketTagsDatasource.id: {\n return this.direct.bitbucket.getDigest(source, tag);\n }\n case GitlabTagsDatasource.id: {\n return this.direct.gitlab.getDigest(source, tag);\n }\n /* v8 ignore next 3: can never happen, makes lint happy */\n default: {\n return null;\n }\n }\n }\n\n override getDigest(\n config: DigestConfig,\n newValue?: string,\n ): Promise<string | null> {\n return withCache(\n {\n namespace: `datasource-${GoDatasource.id}`,\n key: `getDigest:${config.packageName}:${newValue}`,\n fallback: true,\n },\n () => this._getDigest(config, newValue),\n );\n }\n}\n\nconst env = getEnv();\n/* v8 ignore if -- hard to test */\nif (isString(env.GOPROXY)) {\n const uri = parseUrl(env.GOPROXY);\n if (uri?.password) {\n addSecretForSanitizing(uri.password, 'global');\n } else if (uri?.username) {\n addSecretForSanitizing(uri.username, 'global');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,eAAb,MAAa,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C3B,OAAO,KAAK,OAAO,UAAU,UAAU,QAAQ,GAAG;GAEpD,KAAK,qBAAqB,IACxB,OAAO,KAAK,OAAO,OAAO,UAAU,QAAQ,GAAG;;GAGjD,SACE,OAAO;EAEX;CACF;CAEA,UACE,QACA,UACwB;EACxB,OAAO,UACL;GACE,WAAW,cAAc,aAAa;GACtC,KAAK,aAAa,OAAO,YAAY,GAAG;GACxC,UAAU;EACZ,SACM,KAAK,WAAW,QAAQ,QAAQ,CACxC;CACF;AACF;AAEA,MAAM,MAAM,OAAO;;AAEnB,IAAI,SAAS,IAAI,OAAO,GAAG;CACzB,MAAM,MAAM,SAAS,IAAI,OAAO;CAChC,IAAI,KAAK,UACP,uBAAuB,IAAI,UAAU,QAAQ;MACxC,IAAI,KAAK,UACd,uBAAuB,IAAI,UAAU,QAAQ;AAEjD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getEnv } from "../../../util/env.js";
|
|
2
2
|
import { newlineRegex, regEx } from "../../../util/regex.js";
|
|
3
3
|
import { logger } from "../../../logger/index.js";
|
|
4
|
-
import { joinUrlParts } from "../../../util/url.js";
|
|
4
|
+
import { joinUrlParts, parseUrl, trimLeadingSlash, trimTrailingSlash } from "../../../util/url.js";
|
|
5
|
+
import { detectPlatform } from "../../../util/common.js";
|
|
5
6
|
import { ExternalHostError } from "../../../types/errors/external-host-error.js";
|
|
6
7
|
import { filterMap } from "../../../util/filter-map.js";
|
|
7
8
|
import { api } from "../../versioning/go-mod-directive/index.js";
|
|
@@ -11,6 +12,9 @@ import "../../../util/http/index.js";
|
|
|
11
12
|
import { asTimestamp } from "../../../util/timestamp.js";
|
|
12
13
|
import { Datasource } from "../datasource.js";
|
|
13
14
|
import { map } from "../../../util/promises.js";
|
|
15
|
+
import { GithubHttp } from "../../../util/http/github.js";
|
|
16
|
+
import { queryReleases } from "../../../util/github/graphql/index.js";
|
|
17
|
+
import { GithubReleasesDatasource } from "../github-releases/index.js";
|
|
14
18
|
import { BaseGoDatasource } from "./base.js";
|
|
15
19
|
import { parseGoproxy, parseNoproxy } from "./goproxy-parser.js";
|
|
16
20
|
import { getSourceUrl } from "./common.js";
|
|
@@ -21,6 +25,13 @@ import { isNonEmptyString, isNonEmptyStringAndNotWhitespace, isTruthy } from "@s
|
|
|
21
25
|
/** TODO #42566 */
|
|
22
26
|
const goVersionRegex = regEx(/^\s*go\s+(?<version>[^\s]+)\s*$/);
|
|
23
27
|
const modRegex = regEx(/^(?<baseMod>.*?)(?:[./]v(?<majorVersion>\d+))?$/);
|
|
28
|
+
const versionTagRegex = regEx(/^v\d/);
|
|
29
|
+
/**
|
|
30
|
+
* Modules with a major version of v2 or above which have no `go.mod` are reported by a Go proxy with a `+incompatible` suffix, which is absent from the tag they were published as.
|
|
31
|
+
*
|
|
32
|
+
* @see https://go.dev/ref/mod#non-module-compat
|
|
33
|
+
*/
|
|
34
|
+
const incompatibleSuffixRegex = regEx(/\+incompatible$/);
|
|
24
35
|
/**
|
|
25
36
|
* @see https://go.dev/ref/mod#pseudo-versions
|
|
26
37
|
*/
|
|
@@ -35,12 +46,30 @@ function pseudoVersionToRelease(pseudoVersion) {
|
|
|
35
46
|
releaseTimestamp: asTimestamp(timestamp)
|
|
36
47
|
};
|
|
37
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* A Go module which lives in a subdirectory of its repository is tagged with that subdirectory as a prefix, so `github.com/aws/aws-sdk-go-v2/service/s3` publishes `v1.2.3` as the tag `service/s3/v1.2.3`.
|
|
51
|
+
*
|
|
52
|
+
* @see https://go.dev/ref/mod#vcs-version
|
|
53
|
+
*
|
|
54
|
+
* Because we can't tell from the module path alone where the repository ends and the subdirectory begins, we try each candidate prefix - longest first - against the tags we actually found, in the same way as `filterByPrefix` does for direct lookups.
|
|
55
|
+
*/
|
|
56
|
+
function getTagPrefix(goModule, tags) {
|
|
57
|
+
const nameParts = goModule.replace(regEx(/\/v\d+$/), "").split("/").slice(1);
|
|
58
|
+
const tagNames = [...tags];
|
|
59
|
+
while (nameParts.length) {
|
|
60
|
+
const prefix = `${nameParts.join("/")}/`;
|
|
61
|
+
if (tagNames.some((tag) => tag.startsWith(prefix) && versionTagRegex.test(tag.slice(prefix.length)))) return prefix;
|
|
62
|
+
nameParts.shift();
|
|
63
|
+
}
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
38
66
|
var GoProxyDatasource = class GoProxyDatasource extends Datasource {
|
|
39
67
|
static id = "go-proxy";
|
|
40
68
|
constructor() {
|
|
41
69
|
super(GoProxyDatasource.id);
|
|
42
70
|
}
|
|
43
71
|
direct = new GoDirectDatasource();
|
|
72
|
+
githubHttp = new GithubHttp(GithubReleasesDatasource.id);
|
|
44
73
|
async _getReleases(config) {
|
|
45
74
|
const { packageName } = config;
|
|
46
75
|
logger.trace(`goproxy.getReleases(${packageName})`);
|
|
@@ -49,6 +78,7 @@ var GoProxyDatasource = class GoProxyDatasource extends Datasource {
|
|
|
49
78
|
const proxyList = parseGoproxy(goproxy);
|
|
50
79
|
const noproxy = parseNoproxy();
|
|
51
80
|
let result = null;
|
|
81
|
+
let servedByProxy = false;
|
|
52
82
|
if (noproxy?.test(packageName)) {
|
|
53
83
|
logger.debug(`Fetching ${packageName} via GONOPROXY match`);
|
|
54
84
|
result = await this.direct.getReleases(config);
|
|
@@ -63,6 +93,7 @@ var GoProxyDatasource = class GoProxyDatasource extends Datasource {
|
|
|
63
93
|
const res = await this.getVersionsWithInfo(url, packageName, config.constraintsFiltering);
|
|
64
94
|
if (res.releases.length) {
|
|
65
95
|
result = res;
|
|
96
|
+
servedByProxy = true;
|
|
66
97
|
break;
|
|
67
98
|
}
|
|
68
99
|
} catch (err) {
|
|
@@ -79,8 +110,40 @@ var GoProxyDatasource = class GoProxyDatasource extends Datasource {
|
|
|
79
110
|
} catch (err) {
|
|
80
111
|
logger.trace({ err }, `Can't get datasource for ${packageName}`);
|
|
81
112
|
}
|
|
113
|
+
if (result?.sourceUrl && servedByProxy) await this.addGithubReleaseTimestamps(packageName, result.sourceUrl, result.releases);
|
|
82
114
|
return result;
|
|
83
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* A Go proxy reports the commit time of the tagged commit as a version's `Time`, which can be much earlier than the point at which that version was released.
|
|
118
|
+
*
|
|
119
|
+
* When the module is hosted on GitHub and the version has a GitHub Release, the Release's publication time is a better indicator of when the version became available.
|
|
120
|
+
*/
|
|
121
|
+
async addGithubReleaseTimestamps(packageName, sourceUrl, releases) {
|
|
122
|
+
if (detectPlatform(sourceUrl) !== "github") return;
|
|
123
|
+
const parsedUrl = parseUrl(sourceUrl);
|
|
124
|
+
/* v8 ignore next 3 -- detectPlatform only returns a platform for parseable URLs */
|
|
125
|
+
if (!parsedUrl) return;
|
|
126
|
+
const repository = trimTrailingSlash(trimLeadingSlash(parsedUrl.pathname)).replace(regEx(/\.git$/), "");
|
|
127
|
+
try {
|
|
128
|
+
const githubReleases = await queryReleases({
|
|
129
|
+
packageName: repository,
|
|
130
|
+
registryUrl: parsedUrl.origin
|
|
131
|
+
}, this.githubHttp);
|
|
132
|
+
const timestamps = /* @__PURE__ */ new Map();
|
|
133
|
+
for (const { version, releaseTimestamp } of githubReleases) timestamps.set(version, releaseTimestamp);
|
|
134
|
+
const tagPrefix = getTagPrefix(packageName, timestamps.keys());
|
|
135
|
+
for (const release of releases) {
|
|
136
|
+
const version = release.version.replace(incompatibleSuffixRegex, "");
|
|
137
|
+
const releaseTimestamp = timestamps.get(`${tagPrefix}${version}`);
|
|
138
|
+
if (releaseTimestamp && (!release.releaseTimestamp || releaseTimestamp > release.releaseTimestamp)) release.releaseTimestamp = releaseTimestamp;
|
|
139
|
+
}
|
|
140
|
+
} catch (err) {
|
|
141
|
+
logger.debug({
|
|
142
|
+
err,
|
|
143
|
+
packageName
|
|
144
|
+
}, "Error fetching GitHub Releases for Go module");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
84
147
|
getReleases(config) {
|
|
85
148
|
return withCache({
|
|
86
149
|
namespace: `datasource-${GoProxyDatasource.id}`,
|
|
@@ -239,6 +302,6 @@ var GoProxyDatasource = class GoProxyDatasource extends Datasource {
|
|
|
239
302
|
}
|
|
240
303
|
};
|
|
241
304
|
//#endregion
|
|
242
|
-
export { GoProxyDatasource, pseudoVersionToRelease };
|
|
305
|
+
export { GoProxyDatasource, getTagPrefix, pseudoVersionToRelease };
|
|
243
306
|
|
|
244
307
|
//# sourceMappingURL=releases-goproxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releases-goproxy.js","names":["p.map","HttpError","goVersioning"],"sources":["../../../../lib/modules/datasource/go/releases-goproxy.ts"],"sourcesContent":["import {\n isNonEmptyString,\n isNonEmptyStringAndNotWhitespace,\n isTruthy,\n} from '@sindresorhus/is';\nimport type { ConstraintsFilter } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { filterMap } from '../../../util/filter-map.ts';\nimport { HttpError } from '../../../util/http/index.ts';\nimport * as p from '../../../util/promises.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport { joinUrlParts } from '../../../util/url.ts';\nimport goVersioning from '../../versioning/go-mod-directive/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { BaseGoDatasource } from './base.ts';\nimport { getSourceUrl } from './common.ts';\nimport { parseGoproxy, parseNoproxy } from './goproxy-parser.ts';\nimport { GoDirectDatasource } from './releases-direct.ts';\nimport { VersionInfo } from './schema.ts';\n\n/** TODO #42566 */\nconst goVersionRegex = regEx(/^\\s*go\\s+(?<version>[^\\s]+)\\s*$/);\n\nconst modRegex = regEx(/^(?<baseMod>.*?)(?:[./]v(?<majorVersion>\\d+))?$/);\n\n/**\n * @see https://go.dev/ref/mod#pseudo-versions\n */\nconst pseudoVersionRegex = regEx(\n /v\\d+\\.\\d+\\.\\d+-(?:\\w+\\.)?(?:0\\.)?(?<timestamp>\\d{14})-(?<digest>[a-f0-9]{12})/i,\n);\n\nexport function pseudoVersionToRelease(pseudoVersion: string): Release | null {\n const match = pseudoVersion.match(pseudoVersionRegex)?.groups;\n if (!match) {\n return null;\n }\n\n const { digest: newDigest, timestamp } = match;\n const releaseTimestamp = asTimestamp(timestamp);\n\n return {\n version: pseudoVersion,\n newDigest,\n releaseTimestamp,\n };\n}\n\nexport class GoProxyDatasource extends Datasource {\n static readonly id = 'go-proxy';\n\n constructor() {\n super(GoProxyDatasource.id);\n }\n\n readonly direct = new GoDirectDatasource();\n\n private async _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const { packageName } = config;\n logger.trace(`goproxy.getReleases(${packageName})`);\n const goproxy = getEnv().GOPROXY ?? 'https://proxy.golang.org,direct';\n if (goproxy === 'direct') {\n return this.direct.getReleases(config);\n }\n const proxyList = parseGoproxy(goproxy);\n const noproxy = parseNoproxy();\n\n let result: ReleaseResult | null = null;\n\n if (noproxy?.test(packageName)) {\n logger.debug(`Fetching ${packageName} via GONOPROXY match`);\n result = await this.direct.getReleases(config);\n return result;\n }\n\n for (const { url, fallback } of proxyList) {\n try {\n if (url === 'off') {\n break;\n } else if (url === 'direct') {\n result = await this.direct.getReleases(config);\n break;\n }\n\n const res = await this.getVersionsWithInfo(\n url,\n packageName,\n config.constraintsFiltering,\n );\n if (res.releases.length) {\n result = res;\n break;\n }\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const statusCode = potentialHttpError?.response?.statusCode;\n const canFallback =\n fallback === '|' ? true : statusCode === 404 || statusCode === 410;\n const msg = canFallback\n ? 'Goproxy error: trying next URL provided with GOPROXY'\n : 'Goproxy error: skipping other URLs provided with GOPROXY';\n logger.debug({ err }, msg);\n if (!canFallback) {\n break;\n }\n }\n }\n\n if (result && !result.sourceUrl) {\n try {\n const datasource = await BaseGoDatasource.getDatasource(packageName);\n const sourceUrl = getSourceUrl(datasource);\n if (sourceUrl) {\n result.sourceUrl = sourceUrl;\n }\n } catch (err) {\n logger.trace({ err }, `Can't get datasource for ${packageName}`);\n }\n }\n\n return result;\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getCacheKey(config),\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n /**\n * Avoid ambiguity when serving from case-insensitive file systems.\n *\n * @see https://golang.org/ref/mod#goproxy-protocol\n */\n encodeCase(input: string): string {\n return input.replace(regEx(/([A-Z])/g), (x) => `!${x.toLowerCase()}`);\n }\n\n async listVersions(baseUrl: string, packageName: string): Promise<Release[]> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n 'list',\n );\n const { body } = await this.http.getText(url);\n return filterMap(body.split(newlineRegex), (str) => {\n if (!isNonEmptyStringAndNotWhitespace(str)) {\n return null;\n }\n\n const [version, timestamp] = str.trim().split(regEx(/\\s+/));\n const release: Release = pseudoVersionToRelease(version) ?? { version };\n\n const releaseTimestamp = asTimestamp(timestamp);\n if (releaseTimestamp) {\n release.releaseTimestamp = releaseTimestamp;\n }\n\n return release;\n });\n }\n\n async versionInfo(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<Release> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.info`,\n );\n const res = await this.http.getJson(url, VersionInfo);\n\n const result: Release = {\n version: res.body.Version,\n };\n\n const releaseTimestamp = asTimestamp(res.body.Time);\n if (releaseTimestamp) {\n result.releaseTimestamp = releaseTimestamp;\n }\n\n return result;\n }\n\n /**\n * Retrieve the `go` directive for a given Go Module.\n *\n * NOTE that this means the `go` directive, not the `toolchain` directive.\n */\n async retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getVersionedCacheKey(packageName, version),\n // a module's `go.mod` should /never/ change after it's published. If going via the Go Proxy and the Go Checksum Database, a change in this value will result in build failures.\n ttlMinutes: 100 * 24 * 60,\n },\n () => this._retrieveGoDirectiveForModule(baseUrl, packageName, version),\n );\n }\n\n async _retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.mod`,\n );\n const res = await this.http.getText(url);\n\n let goDirective: string | undefined = undefined;\n\n for (const line of res.body.split('\\n')) {\n const goVersionMatches = goVersionRegex.exec(line)?.groups;\n if (goVersionMatches) {\n goDirective = goVersionMatches.version;\n break;\n }\n }\n\n if (!goDirective) {\n return goDirective;\n }\n\n // always return it in full SemVer format, which can then be matched on using `semver` or `semver-coerced`\n const parts = goDirective.split('.');\n if (parts.length === 1) {\n return `${parts[0]}.0.0`;\n }\n if (parts.length === 2) {\n return `${parts[0]}.${parts[1]}.0`;\n }\n return `${parts[0]}.${parts[1]}.${parts[2]}`;\n }\n\n async getLatestVersion(\n baseUrl: string,\n packageName: string,\n ): Promise<{ version: string; sourceUrl?: string } | null> {\n try {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@latest',\n );\n const res = await this.http.getJson(url, VersionInfo);\n const { Version: version, Origin: origin } = res.body;\n // Extract sourceUrl from GOPROXY Origin when present, avoiding go-get to\n // vanity hosts (https://github.com/renovatebot/renovate/discussions/44898)\n const sourceUrl =\n origin?.VCS === 'git' && isNonEmptyString(origin.URL)\n ? origin.URL.replace(regEx(/\\.git$/), '')\n : undefined;\n return { version, sourceUrl };\n } catch (err) {\n logger.trace({ err }, 'Failed to get latest version');\n return null;\n }\n }\n\n async getVersionsWithInfo(\n baseUrl: string,\n packageName: string,\n constraintsFiltering: ConstraintsFilter | undefined,\n ): Promise<ReleaseResult> {\n const isGopkgin = packageName.startsWith('gopkg.in/');\n const majorSuffixSeparator = isGopkgin ? '.' : '/';\n const modParts = packageName.match(modRegex)?.groups;\n const baseMod =\n modParts?.baseMod ??\n /* v8 ignore next -- defensive: modRegex matches any non-empty package name, so baseMod is always set */ packageName;\n const packageMajor = parseInt(modParts?.majorVersion ?? '0', 10);\n\n const result: ReleaseResult = { releases: [] };\n for (let major = packageMajor; ; major += 1) {\n let pkg = `${baseMod}${majorSuffixSeparator}v${major}`;\n if (!isGopkgin && major < 2) {\n pkg = baseMod;\n major += 1; // v0 and v1 are the same module\n }\n\n let releases: Release[] = [];\n\n try {\n const res = await this.listVersions(baseUrl, pkg);\n\n // Artifactory returns all versions in any major (past and future),\n // so starting from v2, we filter them in order to avoid the infinite loop\n const filteredReleases = res.filter(({ version }) => {\n if (major < 2) {\n return true;\n }\n\n return (\n version.split(regEx(/[^\\d]+/)).find(isTruthy) === major.toString()\n );\n });\n\n releases = await p.map(filteredReleases, async (versionInfo) => {\n const { version, newDigest, releaseTimestamp } = versionInfo;\n\n if (releaseTimestamp) {\n return { version, newDigest, releaseTimestamp };\n }\n\n try {\n return await this.versionInfo(baseUrl, pkg, version);\n } catch (err) {\n logger.trace({ err }, `Can't obtain data from ${baseUrl}`);\n return { version };\n }\n });\n\n if (constraintsFiltering === 'strict') {\n releases = await p.map(releases, async (rel) => {\n try {\n const goDirective = await this.retrieveGoDirectiveForModule(\n baseUrl,\n pkg,\n rel.version,\n );\n if (goDirective) {\n rel.constraints ??= {};\n rel.constraints['%goMod'] ??= [];\n rel.constraints['%goMod'].push(goDirective);\n }\n } catch (err) {\n logger.trace(\n { err },\n `Can't obtain \\`go\\` directive from ${baseUrl}`,\n );\n }\n\n return rel;\n });\n }\n\n result.releases.push(...releases);\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const status = potentialHttpError.response?.statusCode;\n if (\n potentialHttpError instanceof HttpError &&\n (status === 404 || status === 403) &&\n major !== packageMajor\n ) {\n break;\n }\n\n throw err;\n }\n\n const latest = await this.getLatestVersion(baseUrl, pkg);\n if (latest) {\n const { version: latestVersion, sourceUrl } = latest;\n result.tags ??= {};\n result.tags.latest ??= latestVersion;\n if (goVersioning.isGreaterThan(latestVersion, result.tags.latest)) {\n result.tags.latest = latestVersion;\n }\n if (sourceUrl) {\n result.sourceUrl ??= sourceUrl;\n }\n if (!result.releases.length) {\n const releaseFromLatest = pseudoVersionToRelease(latestVersion);\n if (releaseFromLatest) {\n result.releases.push(releaseFromLatest);\n }\n }\n }\n\n if (!releases.length) {\n break;\n }\n }\n\n return result;\n }\n\n static getCacheKey({\n packageName,\n constraintsFiltering,\n }: GetReleasesConfig): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n const constraintsFilteringKey =\n constraintsFiltering && constraintsFiltering !== 'none'\n ? `@@${constraintsFiltering}`\n : '';\n // TODO: types (#22198)\n return `${packageName}@@${goproxy}@@${noproxy?.toString()}${constraintsFilteringKey}`;\n }\n\n static getVersionedCacheKey(packageName: string, version: string): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n // TODO: types (#22198)\n return `${packageName}@@${version}@@${goproxy}@@${noproxy?.toString()}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,iBAAiB,MAAM,iCAAiC;AAE9D,MAAM,WAAW,MAAM,iDAAiD;;;;AAKxE,MAAM,qBAAqB,MACzB,gFACF;AAEA,SAAgB,uBAAuB,eAAuC;CAC5E,MAAM,QAAQ,cAAc,MAAM,kBAAkB,CAAC,EAAE;CACvD,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,EAAE,QAAQ,WAAW,cAAc;CAGzC,OAAO;EACL,SAAS;EACT;EACA,kBALuB,YAAY,SAKpB;CACjB;AACF;AAEA,IAAa,oBAAb,MAAa,0BAA0B,WAAW;CAChD,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,kBAAkB,EAAE;CAC5B;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A8BC,iBAC7B,WAAW,OAAO,WAAW,QAC9B,UAAU,cAEV;IAGF,MAAM;GACR;GAEA,MAAM,SAAS,MAAM,KAAK,iBAAiB,SAAS,GAAG;GACvD,IAAI,QAAQ;IACV,MAAM,EAAE,SAAS,eAAe,cAAc;IAC9C,OAAO,SAAS,CAAC;IACjB,OAAO,KAAK,WAAW;IACvB,IAAIC,IAAa,cAAc,eAAe,OAAO,KAAK,MAAM,GAC9D,OAAO,KAAK,SAAS;IAEvB,IAAI,WACF,OAAO,cAAc;IAEvB,IAAI,CAAC,OAAO,SAAS,QAAQ;KAC3B,MAAM,oBAAoB,uBAAuB,aAAa;KAC9D,IAAI,mBACF,OAAO,SAAS,KAAK,iBAAiB;IAE1C;GACF;GAEA,IAAI,CAAC,SAAS,QACZ;EAEJ;EAEA,OAAO;CACT;CAEA,OAAO,YAAY,EACjB,aACA,wBAC4B;EAC5B,MAAM,UAAU,OAAO,CAAC,CAAC;EACzB,MAAM,UAAU,aAAa;EAC7B,MAAM,0BACJ,wBAAwB,yBAAyB,SAC7C,KAAK,yBACL;EAEN,OAAO,GAAG,YAAY,IAAI,QAAQ,IAAI,SAAS,SAAS,IAAI;CAC9D;CAEA,OAAO,qBAAqB,aAAqB,SAAyB;EAIxE,OAAO,GAAG,YAAY,IAAI,QAAQ,IAHlB,OAAO,CAAC,CAAC,QAGqB,IAF9B,aAEwC,CAAC,EAAE,SAAS;CACtE;AACF"}
|
|
1
|
+
{"version":3,"file":"releases-goproxy.js","names":["p.map","HttpError","goVersioning"],"sources":["../../../../lib/modules/datasource/go/releases-goproxy.ts"],"sourcesContent":["import {\n isNonEmptyString,\n isNonEmptyStringAndNotWhitespace,\n isTruthy,\n} from '@sindresorhus/is';\nimport type { ConstraintsFilter } from '../../../config/types.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { filterMap } from '../../../util/filter-map.ts';\nimport { queryReleases } from '../../../util/github/graphql/index.ts';\nimport { GithubHttp } from '../../../util/http/github.ts';\nimport { HttpError } from '../../../util/http/index.ts';\nimport * as p from '../../../util/promises.ts';\nimport { newlineRegex, regEx } from '../../../util/regex.ts';\nimport type { Timestamp } from '../../../util/timestamp.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport {\n joinUrlParts,\n parseUrl,\n trimLeadingSlash,\n trimTrailingSlash,\n} from '../../../util/url.ts';\nimport goVersioning from '../../versioning/go-mod-directive/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport { GithubReleasesDatasource } from '../github-releases/index.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { BaseGoDatasource } from './base.ts';\nimport { getSourceUrl } from './common.ts';\nimport { parseGoproxy, parseNoproxy } from './goproxy-parser.ts';\nimport { GoDirectDatasource } from './releases-direct.ts';\nimport { VersionInfo } from './schema.ts';\n\n/** TODO #42566 */\nconst goVersionRegex = regEx(/^\\s*go\\s+(?<version>[^\\s]+)\\s*$/);\n\nconst modRegex = regEx(/^(?<baseMod>.*?)(?:[./]v(?<majorVersion>\\d+))?$/);\n\nconst versionTagRegex = regEx(/^v\\d/);\n\n/**\n * Modules with a major version of v2 or above which have no `go.mod` are reported by a Go proxy with a `+incompatible` suffix, which is absent from the tag they were published as.\n *\n * @see https://go.dev/ref/mod#non-module-compat\n */\nconst incompatibleSuffixRegex = regEx(/\\+incompatible$/);\n\n/**\n * @see https://go.dev/ref/mod#pseudo-versions\n */\nconst pseudoVersionRegex = regEx(\n /v\\d+\\.\\d+\\.\\d+-(?:\\w+\\.)?(?:0\\.)?(?<timestamp>\\d{14})-(?<digest>[a-f0-9]{12})/i,\n);\n\nexport function pseudoVersionToRelease(pseudoVersion: string): Release | null {\n const match = pseudoVersion.match(pseudoVersionRegex)?.groups;\n if (!match) {\n return null;\n }\n\n const { digest: newDigest, timestamp } = match;\n const releaseTimestamp = asTimestamp(timestamp);\n\n return {\n version: pseudoVersion,\n newDigest,\n releaseTimestamp,\n };\n}\n\n/**\n * A Go module which lives in a subdirectory of its repository is tagged with that subdirectory as a prefix, so `github.com/aws/aws-sdk-go-v2/service/s3` publishes `v1.2.3` as the tag `service/s3/v1.2.3`.\n *\n * @see https://go.dev/ref/mod#vcs-version\n *\n * Because we can't tell from the module path alone where the repository ends and the subdirectory begins, we try each candidate prefix - longest first - against the tags we actually found, in the same way as `filterByPrefix` does for direct lookups.\n */\nexport function getTagPrefix(goModule: string, tags: Iterable<string>): string {\n const nameParts = goModule\n .replace(regEx(/\\/v\\d+$/), '')\n .split('/')\n .slice(1);\n const tagNames = [...tags];\n\n while (nameParts.length) {\n const prefix = `${nameParts.join('/')}/`;\n\n const isUsed = tagNames.some(\n (tag) =>\n tag.startsWith(prefix) &&\n versionTagRegex.test(tag.slice(prefix.length)),\n );\n if (isUsed) {\n return prefix;\n }\n\n nameParts.shift();\n }\n\n return '';\n}\n\nexport class GoProxyDatasource extends Datasource {\n static readonly id = 'go-proxy';\n\n constructor() {\n super(GoProxyDatasource.id);\n }\n\n readonly direct = new GoDirectDatasource();\n\n private readonly githubHttp = new GithubHttp(GithubReleasesDatasource.id);\n\n private async _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const { packageName } = config;\n logger.trace(`goproxy.getReleases(${packageName})`);\n const goproxy = getEnv().GOPROXY ?? 'https://proxy.golang.org,direct';\n if (goproxy === 'direct') {\n return this.direct.getReleases(config);\n }\n const proxyList = parseGoproxy(goproxy);\n const noproxy = parseNoproxy();\n\n let result: ReleaseResult | null = null;\n let servedByProxy = false;\n\n if (noproxy?.test(packageName)) {\n logger.debug(`Fetching ${packageName} via GONOPROXY match`);\n result = await this.direct.getReleases(config);\n return result;\n }\n\n for (const { url, fallback } of proxyList) {\n try {\n if (url === 'off') {\n break;\n } else if (url === 'direct') {\n result = await this.direct.getReleases(config);\n break;\n }\n\n const res = await this.getVersionsWithInfo(\n url,\n packageName,\n config.constraintsFiltering,\n );\n if (res.releases.length) {\n result = res;\n servedByProxy = true;\n break;\n }\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const statusCode = potentialHttpError?.response?.statusCode;\n const canFallback =\n fallback === '|' ? true : statusCode === 404 || statusCode === 410;\n const msg = canFallback\n ? 'Goproxy error: trying next URL provided with GOPROXY'\n : 'Goproxy error: skipping other URLs provided with GOPROXY';\n logger.debug({ err }, msg);\n if (!canFallback) {\n break;\n }\n }\n }\n\n if (result && !result.sourceUrl) {\n try {\n const datasource = await BaseGoDatasource.getDatasource(packageName);\n const sourceUrl = getSourceUrl(datasource);\n if (sourceUrl) {\n result.sourceUrl = sourceUrl;\n }\n } catch (err) {\n logger.trace({ err }, `Can't get datasource for ${packageName}`);\n }\n }\n\n if (result?.sourceUrl && servedByProxy) {\n await this.addGithubReleaseTimestamps(\n packageName,\n result.sourceUrl,\n result.releases,\n );\n }\n\n return result;\n }\n\n /**\n * A Go proxy reports the commit time of the tagged commit as a version's `Time`, which can be much earlier than the point at which that version was released.\n *\n * When the module is hosted on GitHub and the version has a GitHub Release, the Release's publication time is a better indicator of when the version became available.\n */\n async addGithubReleaseTimestamps(\n packageName: string,\n sourceUrl: string,\n releases: Release[],\n ): Promise<void> {\n if (detectPlatform(sourceUrl) !== 'github') {\n return;\n }\n\n const parsedUrl = parseUrl(sourceUrl);\n /* v8 ignore next 3 -- detectPlatform only returns a platform for parseable URLs */\n if (!parsedUrl) {\n return;\n }\n\n const repository = trimTrailingSlash(\n trimLeadingSlash(parsedUrl.pathname),\n ).replace(regEx(/\\.git$/), '');\n\n try {\n const githubReleases = await queryReleases(\n {\n packageName: repository,\n registryUrl: parsedUrl.origin,\n },\n this.githubHttp,\n );\n\n const timestamps = new Map<string, Timestamp>();\n for (const { version, releaseTimestamp } of githubReleases) {\n timestamps.set(version, releaseTimestamp);\n }\n\n const tagPrefix = getTagPrefix(packageName, timestamps.keys());\n for (const release of releases) {\n const version = release.version.replace(incompatibleSuffixRegex, '');\n const releaseTimestamp = timestamps.get(`${tagPrefix}${version}`);\n if (\n releaseTimestamp &&\n (!release.releaseTimestamp ||\n releaseTimestamp > release.releaseTimestamp)\n ) {\n release.releaseTimestamp = releaseTimestamp;\n }\n }\n } catch (err) {\n logger.debug(\n { err, packageName },\n 'Error fetching GitHub Releases for Go module',\n );\n }\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getCacheKey(config),\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n\n /**\n * Avoid ambiguity when serving from case-insensitive file systems.\n *\n * @see https://golang.org/ref/mod#goproxy-protocol\n */\n encodeCase(input: string): string {\n return input.replace(regEx(/([A-Z])/g), (x) => `!${x.toLowerCase()}`);\n }\n\n async listVersions(baseUrl: string, packageName: string): Promise<Release[]> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n 'list',\n );\n const { body } = await this.http.getText(url);\n return filterMap(body.split(newlineRegex), (str) => {\n if (!isNonEmptyStringAndNotWhitespace(str)) {\n return null;\n }\n\n const [version, timestamp] = str.trim().split(regEx(/\\s+/));\n const release: Release = pseudoVersionToRelease(version) ?? { version };\n\n const releaseTimestamp = asTimestamp(timestamp);\n if (releaseTimestamp) {\n release.releaseTimestamp = releaseTimestamp;\n }\n\n return release;\n });\n }\n\n async versionInfo(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<Release> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.info`,\n );\n const res = await this.http.getJson(url, VersionInfo);\n\n const result: Release = {\n version: res.body.Version,\n };\n\n const releaseTimestamp = asTimestamp(res.body.Time);\n if (releaseTimestamp) {\n result.releaseTimestamp = releaseTimestamp;\n }\n\n return result;\n }\n\n /**\n * Retrieve the `go` directive for a given Go Module.\n *\n * NOTE that this means the `go` directive, not the `toolchain` directive.\n */\n async retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n return withCache(\n {\n namespace: `datasource-${GoProxyDatasource.id}`,\n key: GoProxyDatasource.getVersionedCacheKey(packageName, version),\n // a module's `go.mod` should /never/ change after it's published. If going via the Go Proxy and the Go Checksum Database, a change in this value will result in build failures.\n ttlMinutes: 100 * 24 * 60,\n },\n () => this._retrieveGoDirectiveForModule(baseUrl, packageName, version),\n );\n }\n\n async _retrieveGoDirectiveForModule(\n baseUrl: string,\n packageName: string,\n version: string,\n ): Promise<string | undefined> {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@v',\n `${version}.mod`,\n );\n const res = await this.http.getText(url);\n\n let goDirective: string | undefined = undefined;\n\n for (const line of res.body.split('\\n')) {\n const goVersionMatches = goVersionRegex.exec(line)?.groups;\n if (goVersionMatches) {\n goDirective = goVersionMatches.version;\n break;\n }\n }\n\n if (!goDirective) {\n return goDirective;\n }\n\n // always return it in full SemVer format, which can then be matched on using `semver` or `semver-coerced`\n const parts = goDirective.split('.');\n if (parts.length === 1) {\n return `${parts[0]}.0.0`;\n }\n if (parts.length === 2) {\n return `${parts[0]}.${parts[1]}.0`;\n }\n return `${parts[0]}.${parts[1]}.${parts[2]}`;\n }\n\n async getLatestVersion(\n baseUrl: string,\n packageName: string,\n ): Promise<{ version: string; sourceUrl?: string } | null> {\n try {\n const url = joinUrlParts(\n baseUrl,\n this.encodeCase(packageName),\n '@latest',\n );\n const res = await this.http.getJson(url, VersionInfo);\n const { Version: version, Origin: origin } = res.body;\n // Extract sourceUrl from GOPROXY Origin when present, avoiding go-get to\n // vanity hosts (https://github.com/renovatebot/renovate/discussions/44898)\n const sourceUrl =\n origin?.VCS === 'git' && isNonEmptyString(origin.URL)\n ? origin.URL.replace(regEx(/\\.git$/), '')\n : undefined;\n return { version, sourceUrl };\n } catch (err) {\n logger.trace({ err }, 'Failed to get latest version');\n return null;\n }\n }\n\n async getVersionsWithInfo(\n baseUrl: string,\n packageName: string,\n constraintsFiltering: ConstraintsFilter | undefined,\n ): Promise<ReleaseResult> {\n const isGopkgin = packageName.startsWith('gopkg.in/');\n const majorSuffixSeparator = isGopkgin ? '.' : '/';\n const modParts = packageName.match(modRegex)?.groups;\n const baseMod =\n modParts?.baseMod ??\n /* v8 ignore next -- defensive: modRegex matches any non-empty package name, so baseMod is always set */ packageName;\n const packageMajor = parseInt(modParts?.majorVersion ?? '0', 10);\n\n const result: ReleaseResult = { releases: [] };\n for (let major = packageMajor; ; major += 1) {\n let pkg = `${baseMod}${majorSuffixSeparator}v${major}`;\n if (!isGopkgin && major < 2) {\n pkg = baseMod;\n major += 1; // v0 and v1 are the same module\n }\n\n let releases: Release[] = [];\n\n try {\n const res = await this.listVersions(baseUrl, pkg);\n\n // Artifactory returns all versions in any major (past and future),\n // so starting from v2, we filter them in order to avoid the infinite loop\n const filteredReleases = res.filter(({ version }) => {\n if (major < 2) {\n return true;\n }\n\n return (\n version.split(regEx(/[^\\d]+/)).find(isTruthy) === major.toString()\n );\n });\n\n releases = await p.map(filteredReleases, async (versionInfo) => {\n const { version, newDigest, releaseTimestamp } = versionInfo;\n\n if (releaseTimestamp) {\n return { version, newDigest, releaseTimestamp };\n }\n\n try {\n return await this.versionInfo(baseUrl, pkg, version);\n } catch (err) {\n logger.trace({ err }, `Can't obtain data from ${baseUrl}`);\n return { version };\n }\n });\n\n if (constraintsFiltering === 'strict') {\n releases = await p.map(releases, async (rel) => {\n try {\n const goDirective = await this.retrieveGoDirectiveForModule(\n baseUrl,\n pkg,\n rel.version,\n );\n if (goDirective) {\n rel.constraints ??= {};\n rel.constraints['%goMod'] ??= [];\n rel.constraints['%goMod'].push(goDirective);\n }\n } catch (err) {\n logger.trace(\n { err },\n `Can't obtain \\`go\\` directive from ${baseUrl}`,\n );\n }\n\n return rel;\n });\n }\n\n result.releases.push(...releases);\n } catch (err) {\n const potentialHttpError =\n err instanceof ExternalHostError ? err.err : err;\n const status = potentialHttpError.response?.statusCode;\n if (\n potentialHttpError instanceof HttpError &&\n (status === 404 || status === 403) &&\n major !== packageMajor\n ) {\n break;\n }\n\n throw err;\n }\n\n const latest = await this.getLatestVersion(baseUrl, pkg);\n if (latest) {\n const { version: latestVersion, sourceUrl } = latest;\n result.tags ??= {};\n result.tags.latest ??= latestVersion;\n if (goVersioning.isGreaterThan(latestVersion, result.tags.latest)) {\n result.tags.latest = latestVersion;\n }\n if (sourceUrl) {\n result.sourceUrl ??= sourceUrl;\n }\n if (!result.releases.length) {\n const releaseFromLatest = pseudoVersionToRelease(latestVersion);\n if (releaseFromLatest) {\n result.releases.push(releaseFromLatest);\n }\n }\n }\n\n if (!releases.length) {\n break;\n }\n }\n\n return result;\n }\n\n static getCacheKey({\n packageName,\n constraintsFiltering,\n }: GetReleasesConfig): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n const constraintsFilteringKey =\n constraintsFiltering && constraintsFiltering !== 'none'\n ? `@@${constraintsFiltering}`\n : '';\n // TODO: types (#22198)\n return `${packageName}@@${goproxy}@@${noproxy?.toString()}${constraintsFilteringKey}`;\n }\n\n static getVersionedCacheKey(packageName: string, version: string): string {\n const goproxy = getEnv().GOPROXY;\n const noproxy = parseNoproxy();\n // TODO: types (#22198)\n return `${packageName}@@${version}@@${goproxy}@@${noproxy?.toString()}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,iBAAiB,MAAM,iCAAiC;AAE9D,MAAM,WAAW,MAAM,iDAAiD;AAExE,MAAM,kBAAkB,MAAM,MAAM;;;;;;AAOpC,MAAM,0BAA0B,MAAM,iBAAiB;;;;AAKvD,MAAM,qBAAqB,MACzB,gFACF;AAEA,SAAgB,uBAAuB,eAAuC;CAC5E,MAAM,QAAQ,cAAc,MAAM,kBAAkB,CAAC,EAAE;CACvD,IAAI,CAAC,OACH,OAAO;CAGT,MAA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ends Datasource {
|
|
|
25
25
|
defaultVersioning = id;
|
|
26
26
|
registryStrategy = "merge";
|
|
27
27
|
releaseTimestampSupport = true;
|
|
28
|
-
releaseTimestampNote = "The
|
|
28
|
+
releaseTimestampNote = "The release timestamp is determined from the earliest `upload_time` field of the files of a version. This field is not available when using the simple API.";
|
|
29
29
|
sourceUrlSupport = "release";
|
|
30
30
|
sourceUrlNote = "The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.";
|
|
31
31
|
async getReleases({ packageName, registryUrl }) {
|
|
@@ -119,11 +119,10 @@ var PypiDatasource = class PypiDatasource extends Datasource {
|
|
|
119
119
|
}
|
|
120
120
|
if (dep.releases) dependency.releases = Object.keys(dep.releases).map((version) => {
|
|
121
121
|
const releases = coerceArray(dep.releases?.[version]);
|
|
122
|
-
const { upload_time: releaseTimestamp } = releases[0] || {};
|
|
123
122
|
const isDeprecated = releases.some(({ yanked }) => yanked);
|
|
124
123
|
const result = {
|
|
125
124
|
version,
|
|
126
|
-
releaseTimestamp:
|
|
125
|
+
releaseTimestamp: PypiDatasource.getEarliestTimestamp(releases)
|
|
127
126
|
};
|
|
128
127
|
if (isDeprecated) result.isDeprecated = isDeprecated;
|
|
129
128
|
const pythonConstraints = releases.map(({ requires_python }) => requires_python).filter(isString);
|
|
@@ -132,6 +131,14 @@ var PypiDatasource = class PypiDatasource extends Datasource {
|
|
|
132
131
|
});
|
|
133
132
|
return dependency;
|
|
134
133
|
}
|
|
134
|
+
static getEarliestTimestamp(releases) {
|
|
135
|
+
let earliest = null;
|
|
136
|
+
for (const { upload_time } of releases) {
|
|
137
|
+
const timestamp = asTimestamp(upload_time);
|
|
138
|
+
if (timestamp && (!earliest || timestamp < earliest)) earliest = timestamp;
|
|
139
|
+
}
|
|
140
|
+
return earliest;
|
|
141
|
+
}
|
|
135
142
|
static extractVersionFromLinkText(text, packageName) {
|
|
136
143
|
const lcText = text.toLowerCase();
|
|
137
144
|
const normalizedSrcText = normalizePythonDepName(text);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["pep440.id"],"sources":["../../../../lib/modules/datasource/pypi/index.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { parse } from '../../../util/html.ts';\nimport type { OutgoingHttpHeaders } from '../../../util/http/types.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport { ensureTrailingSlash, parseUrl } from '../../../util/url.ts';\nimport * as pep440 from '../../versioning/pep440/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { getGoogleAuthToken } from '../util.ts';\nimport { isGitHubRepo, normalizePythonDepName } from './common.ts';\nimport type { PypiRelease } from './schema.ts';\nimport { PypiResponse } from './schema.ts';\nimport type { Releases } from './types.ts';\n\nexport class PypiDatasource extends Datasource {\n static readonly id = 'pypi';\n\n constructor() {\n super(PypiDatasource.id);\n }\n\n override readonly caching = true;\n\n override readonly customRegistrySupport = true;\n\n static readonly defaultURL =\n getEnv().PIP_INDEX_URL ?? 'https://pypi.org/pypi/';\n override readonly defaultRegistryUrls = [PypiDatasource.defaultURL];\n\n override readonly defaultVersioning = pep440.id;\n\n override readonly registryStrategy = 'merge';\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The relase timestamp is determined from the `upload_time` field in the results. This field is not available when using the simple API.';\n override readonly sourceUrlSupport = 'release';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.';\n\n async getReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n let dependency: ReleaseResult | null = null;\n // TODO: null check (#22198)\n const hostUrl = ensureTrailingSlash(\n registryUrl!.replace('https://pypi.org/simple', 'https://pypi.org/pypi'),\n );\n const normalizedLookupName = normalizePythonDepName(packageName);\n\n // not all simple indexes use this identifier, but most do\n if (hostUrl.endsWith('/simple/') || hostUrl.endsWith('/+simple/')) {\n logger.trace(\n { packageName, hostUrl },\n 'Looking up pypi simple dependency',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n } else {\n logger.trace({ packageName, hostUrl }, 'Looking up pypi api dependency');\n try {\n // we need to resolve early here so we can catch any 404s and fallback to a simple lookup\n dependency = await this.getDependency(normalizedLookupName, hostUrl);\n } catch (err) {\n // error contacting json-style api -- attempt to fallback to a simple-style api\n logger.trace(\n { packageName, hostUrl, err },\n 'Looking up pypi simple dependency via fallback',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n }\n }\n return dependency;\n }\n\n private sanitizeLookupUrl(lookupUrl: string, parsedUrl: URL): string {\n if (!parsedUrl.username && !parsedUrl.password) {\n return lookupUrl;\n }\n\n parsedUrl.username = '';\n parsedUrl.password = '';\n return parsedUrl.toString();\n }\n\n private async getAuthHeaders(\n lookupUrl: string,\n ): Promise<{ headers: OutgoingHttpHeaders; lookupUrl: string }> {\n const parsedUrl = parseUrl(lookupUrl);\n // v8 ignore if -- TODO: refactor to cover this branch through public behavior again\n if (!parsedUrl) {\n logger.once.debug({ lookupUrl }, 'Failed to parse URL');\n return { headers: {}, lookupUrl };\n }\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const auth = await getGoogleAuthToken();\n if (auth) {\n const sanitizedLookupUrl = this.sanitizeLookupUrl(lookupUrl, parsedUrl);\n return {\n headers: { authorization: `Basic ${auth}` },\n lookupUrl: sanitizedLookupUrl,\n };\n }\n logger.once.debug({ lookupUrl }, 'Could not get Google access token');\n return { headers: {}, lookupUrl };\n }\n return { headers: {}, lookupUrl };\n }\n\n private async getDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = new URL(\n `${normalizePythonDepName(packageName)}/json`,\n hostUrl,\n ).href;\n const dependency: ReleaseResult = { releases: [] };\n logger.trace({ lookupUrl }, 'Pypi api got lookup');\n const { headers, lookupUrl: sanitizedUrl } =\n await this.getAuthHeaders(lookupUrl);\n const rep = await this.http.getJson(\n sanitizedUrl,\n { headers },\n PypiResponse,\n );\n const dep = rep?.body;\n if (rep.authorization) {\n dependency.isPrivate = true;\n }\n logger.trace({ lookupUrl }, 'Got pypi api result');\n\n if (dep.info?.home_page) {\n dependency.homepage = dep.info.home_page;\n if (isGitHubRepo(dep.info.home_page)) {\n dependency.sourceUrl = dep.info.home_page.replace(\n 'http://',\n 'https://',\n );\n }\n }\n\n if (dep.info?.project_urls) {\n for (const [name, projectUrl] of Object.entries(dep.info.project_urls)) {\n const lower = name.toLowerCase();\n\n if (\n projectUrl &&\n !dependency.sourceUrl &&\n (lower.startsWith('repo') ||\n lower === 'code' ||\n lower === 'source' ||\n isGitHubRepo(projectUrl))\n ) {\n dependency.sourceUrl = projectUrl;\n }\n\n if (\n !dependency.changelogUrl &&\n ([\n 'changelog',\n 'change log',\n 'changes',\n 'release notes',\n 'news',\n \"what's new\",\n ].includes(lower) ||\n changelogFilenameRegex.exec(lower))\n ) {\n // from https://github.com/pypa/warehouse/blob/418c7511dc367fb410c71be139545d0134ccb0df/warehouse/templates/packaging/detail.html#L24\n dependency.changelogUrl = projectUrl;\n }\n }\n }\n\n if (dep.releases) {\n const versions = Object.keys(dep.releases);\n dependency.releases = versions.map((version) => {\n const releases = coerceArray(dep.releases?.[version]);\n const { upload_time: releaseTimestamp } = releases[0] || {};\n const isDeprecated = releases.some(({ yanked }) => yanked);\n const result: Release = {\n version,\n releaseTimestamp: asTimestamp(releaseTimestamp),\n };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n const pythonConstraints = releases\n .map(({ requires_python }) => requires_python)\n .filter(isString);\n result.constraints = {\n python: Array.from(new Set(pythonConstraints)),\n };\n return result;\n });\n }\n return dependency;\n }\n\n private static extractVersionFromLinkText(\n text: string,\n packageName: string,\n ): string | null {\n // source packages\n const lcText = text.toLowerCase();\n const normalizedSrcText = normalizePythonDepName(text);\n const srcPrefix = `${packageName}-`;\n\n // source distribution format: `{name}-{version}.tar.gz` (https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-file-name)\n // binary distribution: `{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl` (https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-name-convention)\n // officially both `name` and `distribution` should be normalized and then the - replaced with _, but in reality this is not the case\n // We therefore normalize the name we have (replacing `_-.` with -) and then check if the text starts with the normalized name\n\n if (!normalizedSrcText.startsWith(srcPrefix)) {\n return null;\n }\n\n // strip off the prefix using the prefix length as we may have normalized the srcPrefix/packageName\n // We assume that neither the version nor the suffix contains multiple `-` like `0.1.2---rc1.tar.gz`\n // and use the difference in length to strip off the prefix in case the name contains double `--` characters\n const normalizedLengthDiff = lcText.length - normalizedSrcText.length;\n const res = lcText.slice(srcPrefix.length + normalizedLengthDiff);\n\n // source distribution\n const srcSuffixes = ['.tar.gz', '.tar.bz2', '.tar.xz', '.zip', '.tgz'];\n const srcSuffix = srcSuffixes.find((suffix) => lcText.endsWith(suffix));\n if (srcSuffix) {\n // strip off the suffix using character length\n return res.slice(0, -srcSuffix.length);\n }\n\n // binary distribution\n // for binary distributions the version is the first part after the removed distribution name\n const wheelSuffix = '.whl';\n if (lcText.endsWith(wheelSuffix) && lcText.split('-').length > 2) {\n return res.split('-')[0];\n }\n return null;\n }\n\n private static cleanSimpleHtml(html: string): string {\n return (\n html\n .replace(regEx(/<\\/?pre>/), '')\n // Certain simple repositories like artifactory don't escape > and <\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)>([^\"]*?)\"/g),\n 'data-requires-python=\"$1>$2\"',\n )\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)<([^\"]*?)\"/g),\n 'data-requires-python=\"$1<$2\"',\n )\n );\n }\n\n private async getSimpleDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = new URL(\n ensureTrailingSlash(normalizePythonDepName(packageName)),\n hostUrl,\n ).href;\n const dependency: ReleaseResult = { releases: [] };\n const { headers, lookupUrl: sanitizedUrl } =\n await this.getAuthHeaders(lookupUrl);\n const response = await this.http.getText(sanitizedUrl, { headers });\n const dep = response?.body;\n if (!dep) {\n logger.trace({ dependency: packageName }, 'pip package not found');\n return null;\n }\n if (response.authorization) {\n dependency.isPrivate = true;\n }\n const root = parse(PypiDatasource.cleanSimpleHtml(dep));\n const links = root.querySelectorAll('a');\n const releases: Releases = {};\n for (const link of Array.from(links)) {\n const version = PypiDatasource.extractVersionFromLinkText(\n link.text?.trim(),\n packageName,\n );\n if (version) {\n const release: PypiRelease = {\n yanked: link.hasAttribute('data-yanked'),\n };\n const requiresPython = link.getAttribute('data-requires-python');\n if (requiresPython) {\n release.requires_python = requiresPython;\n }\n if (!releases[version]) {\n releases[version] = [];\n }\n releases[version].push(release);\n }\n }\n const versions = Object.keys(releases);\n dependency.releases = versions.map((version) => {\n const versionReleases = coerceArray(releases[version]);\n const isDeprecated = versionReleases.some(({ yanked }) => yanked);\n const result: Release = { version };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n result.constraints = {\n // TODO: string[] isn't allowed here\n python: versionReleases.map(\n ({ requires_python }) => requires_python,\n ) as any,\n };\n return result;\n });\n return dependency;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,IAAa,iBAAb,MAAa,uBAAuB,WAAW;CAC7C,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,eAAe,EAAE;CACzB;CAEA,UAA4B;CAE5B,wBAA0C;CAE1C,OAAgB,aACd,OAAO,CAAC,CAAC,iBAAiB;CAC5B,sBAAwC,CAAC,eAAe,UAAU;CAElE,oBAAsCA;CAEtC,mBAAqC;CAErC,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,MAAM,KAAK,eAAe,SAAS;EACrC,MAAM,WAAW,MAAM,KAAK,KAAK,QAAQ,cAAc,EAAE,QAAQ,CAAC;EAClE,MAAM,MAAM,UAAU;EACtB,IAAI,CAAC,KAAK;GACR,OAAO,MAAM,EAAE,YAAY,YAAY,GAAG,uBAAuB;GACjE,OAAO;EACT;EACA,IAAI,SAAS,eACX,WAAW,YAAY;EAGzB,MAAM,QADO,MAAM,eAAe,gBAAgB,GAAG,CACpC,CAAC,CAAC,iBAAiB,GAAG;EACvC,MAAM,WAAqB,CAAC;EAC5B,KAAK,MAAM,QAAQ,MAAM,KAAK,KAAK,GAAG;GACpC,MAAM,UAAU,eAAe,2BAC7B,KAAK,MAAM,KAAK,GAChB,WACF;GACA,IAAI,SAAS;IACX,MAAM,UAAuB,EAC3B,QAAQ,KAAK,aAAa,aAAa,EACzC;IACA,MAAM,iBAAiB,KAAK,aAAa,sBAAsB;IAC/D,IAAI,gBACF,QAAQ,kBAAkB;IAE5B,IAAI,CAAC,SAAS,UACZ,SAAS,WAAW,CAAC;IAEvB,SAAS,QAAQ,CAAC,KAAK,OAAO;GAChC;EACF;EAEA,WAAW,WADM,OAAO,KAAK,QACA,CAAC,CAAC,KAAK,YAAY;GAC9C,MAAM,kBAAkB,YAAY,SAAS,QAAQ;GACrD,MAAM,eAAe,gBAAgB,MAAM,EAAE,aAAa,MAAM;GAChE,MAAM,SAAkB,EAAE,QAAQ;GAClC,IAAI,cACF,OAAO,eAAe;GAGxB,OAAO,cAAc,EAEnB,QAAQ,gBAAgB,KACrB,EAAE,sBAAsB,eAC3B,EACF;GACA,OAAO;EACT,CAAC;EACD,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["pep440.id"],"sources":["../../../../lib/modules/datasource/pypi/index.ts"],"sourcesContent":["import { isString } from '@sindresorhus/is';\nimport changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../logger/index.ts';\nimport { coerceArray } from '../../../util/array.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { parse } from '../../../util/html.ts';\nimport type { OutgoingHttpHeaders } from '../../../util/http/types.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport type { Timestamp } from '../../../util/timestamp.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport { ensureTrailingSlash, parseUrl } from '../../../util/url.ts';\nimport * as pep440 from '../../versioning/pep440/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { getGoogleAuthToken } from '../util.ts';\nimport { isGitHubRepo, normalizePythonDepName } from './common.ts';\nimport type { PypiRelease } from './schema.ts';\nimport { PypiResponse } from './schema.ts';\nimport type { Releases } from './types.ts';\n\nexport class PypiDatasource extends Datasource {\n static readonly id = 'pypi';\n\n constructor() {\n super(PypiDatasource.id);\n }\n\n override readonly caching = true;\n\n override readonly customRegistrySupport = true;\n\n static readonly defaultURL =\n getEnv().PIP_INDEX_URL ?? 'https://pypi.org/pypi/';\n override readonly defaultRegistryUrls = [PypiDatasource.defaultURL];\n\n override readonly defaultVersioning = pep440.id;\n\n override readonly registryStrategy = 'merge';\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the earliest `upload_time` field of the files of a version. This field is not available when using the simple API.';\n override readonly sourceUrlSupport = 'release';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `homepage` field if it is a github repository, else we use the `project_urls` field.';\n\n async getReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n let dependency: ReleaseResult | null = null;\n // TODO: null check (#22198)\n const hostUrl = ensureTrailingSlash(\n registryUrl!.replace('https://pypi.org/simple', 'https://pypi.org/pypi'),\n );\n const normalizedLookupName = normalizePythonDepName(packageName);\n\n // not all simple indexes use this identifier, but most do\n if (hostUrl.endsWith('/simple/') || hostUrl.endsWith('/+simple/')) {\n logger.trace(\n { packageName, hostUrl },\n 'Looking up pypi simple dependency',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n } else {\n logger.trace({ packageName, hostUrl }, 'Looking up pypi api dependency');\n try {\n // we need to resolve early here so we can catch any 404s and fallback to a simple lookup\n dependency = await this.getDependency(normalizedLookupName, hostUrl);\n } catch (err) {\n // error contacting json-style api -- attempt to fallback to a simple-style api\n logger.trace(\n { packageName, hostUrl, err },\n 'Looking up pypi simple dependency via fallback',\n );\n dependency = await this.getSimpleDependency(\n normalizedLookupName,\n hostUrl,\n );\n }\n }\n return dependency;\n }\n\n private sanitizeLookupUrl(lookupUrl: string, parsedUrl: URL): string {\n if (!parsedUrl.username && !parsedUrl.password) {\n return lookupUrl;\n }\n\n parsedUrl.username = '';\n parsedUrl.password = '';\n return parsedUrl.toString();\n }\n\n private async getAuthHeaders(\n lookupUrl: string,\n ): Promise<{ headers: OutgoingHttpHeaders; lookupUrl: string }> {\n const parsedUrl = parseUrl(lookupUrl);\n // v8 ignore if -- TODO: refactor to cover this branch through public behavior again\n if (!parsedUrl) {\n logger.once.debug({ lookupUrl }, 'Failed to parse URL');\n return { headers: {}, lookupUrl };\n }\n if (parsedUrl.hostname.endsWith('.pkg.dev')) {\n const auth = await getGoogleAuthToken();\n if (auth) {\n const sanitizedLookupUrl = this.sanitizeLookupUrl(lookupUrl, parsedUrl);\n return {\n headers: { authorization: `Basic ${auth}` },\n lookupUrl: sanitizedLookupUrl,\n };\n }\n logger.once.debug({ lookupUrl }, 'Could not get Google access token');\n return { headers: {}, lookupUrl };\n }\n return { headers: {}, lookupUrl };\n }\n\n private async getDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = new URL(\n `${normalizePythonDepName(packageName)}/json`,\n hostUrl,\n ).href;\n const dependency: ReleaseResult = { releases: [] };\n logger.trace({ lookupUrl }, 'Pypi api got lookup');\n const { headers, lookupUrl: sanitizedUrl } =\n await this.getAuthHeaders(lookupUrl);\n const rep = await this.http.getJson(\n sanitizedUrl,\n { headers },\n PypiResponse,\n );\n const dep = rep?.body;\n if (rep.authorization) {\n dependency.isPrivate = true;\n }\n logger.trace({ lookupUrl }, 'Got pypi api result');\n\n if (dep.info?.home_page) {\n dependency.homepage = dep.info.home_page;\n if (isGitHubRepo(dep.info.home_page)) {\n dependency.sourceUrl = dep.info.home_page.replace(\n 'http://',\n 'https://',\n );\n }\n }\n\n if (dep.info?.project_urls) {\n for (const [name, projectUrl] of Object.entries(dep.info.project_urls)) {\n const lower = name.toLowerCase();\n\n if (\n projectUrl &&\n !dependency.sourceUrl &&\n (lower.startsWith('repo') ||\n lower === 'code' ||\n lower === 'source' ||\n isGitHubRepo(projectUrl))\n ) {\n dependency.sourceUrl = projectUrl;\n }\n\n if (\n !dependency.changelogUrl &&\n ([\n 'changelog',\n 'change log',\n 'changes',\n 'release notes',\n 'news',\n \"what's new\",\n ].includes(lower) ||\n changelogFilenameRegex.exec(lower))\n ) {\n // from https://github.com/pypa/warehouse/blob/418c7511dc367fb410c71be139545d0134ccb0df/warehouse/templates/packaging/detail.html#L24\n dependency.changelogUrl = projectUrl;\n }\n }\n }\n\n if (dep.releases) {\n const versions = Object.keys(dep.releases);\n dependency.releases = versions.map((version) => {\n const releases = coerceArray(dep.releases?.[version]);\n const isDeprecated = releases.some(({ yanked }) => yanked);\n const result: Release = {\n version,\n releaseTimestamp: PypiDatasource.getEarliestTimestamp(releases),\n };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n const pythonConstraints = releases\n .map(({ requires_python }) => requires_python)\n .filter(isString);\n result.constraints = {\n python: Array.from(new Set(pythonConstraints)),\n };\n return result;\n });\n }\n return dependency;\n }\n\n private static getEarliestTimestamp(\n releases: PypiRelease[],\n ): Timestamp | null {\n let earliest: Timestamp | null = null;\n for (const { upload_time } of releases) {\n const timestamp = asTimestamp(upload_time);\n // `asTimestamp` normalizes to UTC ISO 8601, so comparing the strings compares the instants\n if (timestamp && (!earliest || timestamp < earliest)) {\n earliest = timestamp;\n }\n }\n return earliest;\n }\n\n private static extractVersionFromLinkText(\n text: string,\n packageName: string,\n ): string | null {\n // source packages\n const lcText = text.toLowerCase();\n const normalizedSrcText = normalizePythonDepName(text);\n const srcPrefix = `${packageName}-`;\n\n // source distribution format: `{name}-{version}.tar.gz` (https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-file-name)\n // binary distribution: `{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl` (https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-name-convention)\n // officially both `name` and `distribution` should be normalized and then the - replaced with _, but in reality this is not the case\n // We therefore normalize the name we have (replacing `_-.` with -) and then check if the text starts with the normalized name\n\n if (!normalizedSrcText.startsWith(srcPrefix)) {\n return null;\n }\n\n // strip off the prefix using the prefix length as we may have normalized the srcPrefix/packageName\n // We assume that neither the version nor the suffix contains multiple `-` like `0.1.2---rc1.tar.gz`\n // and use the difference in length to strip off the prefix in case the name contains double `--` characters\n const normalizedLengthDiff = lcText.length - normalizedSrcText.length;\n const res = lcText.slice(srcPrefix.length + normalizedLengthDiff);\n\n // source distribution\n const srcSuffixes = ['.tar.gz', '.tar.bz2', '.tar.xz', '.zip', '.tgz'];\n const srcSuffix = srcSuffixes.find((suffix) => lcText.endsWith(suffix));\n if (srcSuffix) {\n // strip off the suffix using character length\n return res.slice(0, -srcSuffix.length);\n }\n\n // binary distribution\n // for binary distributions the version is the first part after the removed distribution name\n const wheelSuffix = '.whl';\n if (lcText.endsWith(wheelSuffix) && lcText.split('-').length > 2) {\n return res.split('-')[0];\n }\n return null;\n }\n\n private static cleanSimpleHtml(html: string): string {\n return (\n html\n .replace(regEx(/<\\/?pre>/), '')\n // Certain simple repositories like artifactory don't escape > and <\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)>([^\"]*?)\"/g),\n 'data-requires-python=\"$1>$2\"',\n )\n .replace(\n regEx(/data-requires-python=\"([^\"]*?)<([^\"]*?)\"/g),\n 'data-requires-python=\"$1<$2\"',\n )\n );\n }\n\n private async getSimpleDependency(\n packageName: string,\n hostUrl: string,\n ): Promise<ReleaseResult | null> {\n const lookupUrl = new URL(\n ensureTrailingSlash(normalizePythonDepName(packageName)),\n hostUrl,\n ).href;\n const dependency: ReleaseResult = { releases: [] };\n const { headers, lookupUrl: sanitizedUrl } =\n await this.getAuthHeaders(lookupUrl);\n const response = await this.http.getText(sanitizedUrl, { headers });\n const dep = response?.body;\n if (!dep) {\n logger.trace({ dependency: packageName }, 'pip package not found');\n return null;\n }\n if (response.authorization) {\n dependency.isPrivate = true;\n }\n const root = parse(PypiDatasource.cleanSimpleHtml(dep));\n const links = root.querySelectorAll('a');\n const releases: Releases = {};\n for (const link of Array.from(links)) {\n const version = PypiDatasource.extractVersionFromLinkText(\n link.text?.trim(),\n packageName,\n );\n if (version) {\n const release: PypiRelease = {\n yanked: link.hasAttribute('data-yanked'),\n };\n const requiresPython = link.getAttribute('data-requires-python');\n if (requiresPython) {\n release.requires_python = requiresPython;\n }\n if (!releases[version]) {\n releases[version] = [];\n }\n releases[version].push(release);\n }\n }\n const versions = Object.keys(releases);\n dependency.releases = versions.map((version) => {\n const versionReleases = coerceArray(releases[version]);\n const isDeprecated = versionReleases.some(({ yanked }) => yanked);\n const result: Release = { version };\n if (isDeprecated) {\n result.isDeprecated = isDeprecated;\n }\n // There may be multiple releases with different requires_python, so we return all in an array\n result.constraints = {\n // TODO: string[] isn't allowed here\n python: versionReleases.map(\n ({ requires_python }) => requires_python,\n ) as any,\n };\n return result;\n });\n return dependency;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,IAAa,iBAAb,MAAa,uBAAuB,WAAW;CAC7C,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,eAAe,EAAE;CACzB;CAEA,UAA4B;CAE5B,wBAA0C;CAE1C,OAAgB,aACd,OAAO,CAAC,CAAC,iBAAiB;CAC5B,sBAAwC,CAAC,eAAe,UAAU;CAElE,oBAAsCA;CA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c264edf7837fb8fbc4cf0078c8bd2d5a75431039b1db65bf47356
|
|
|
47
47
|
hashMap.set("gitlabci-include", "ef696c478c2ac1723b3aca070ba9779be0e702fff0844054251ba0029523d0eb");
|
|
48
48
|
hashMap.set("glasskube", "93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30");
|
|
49
49
|
hashMap.set("gleam", "02389785183c39d2896d7893414c5e1060023f95c1fe7b595bd06cc5c1186d39");
|
|
50
|
-
hashMap.set("gomod", "
|
|
50
|
+
hashMap.set("gomod", "64ab863d3064caf535e5e85d5f1c18275f5b9471950a342b2804b35d8da1319f");
|
|
51
51
|
hashMap.set("gradle", "550f1107f0ac27d18fa76a7d5c0c0b317b5df4156fc12cfd378573ccfe26fca0");
|
|
52
52
|
hashMap.set("gradle-wrapper", "799d9bb8d9dead673fb513ba4936395f14da30897d33a9df46b3266e1b835d5d");
|
|
53
53
|
hashMap.set("haskell-cabal", "f232d0e883235f74ed71fd9de4a7468e5fcbda9a1af5beb56c24657f7bf2e891");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','1d3568f42393d697f8f96d461b72077ee7a1044b654e87667a12f861b3083111');\nhashMap.set('ansible-galaxy','8226d47128f2018825d4d6f84794e3183eb79c706045fa7e88491edd5e64106f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('argocd','5d35b1992e53130bf83b0e59a0f90ccd3a78919974c69044f306dc5d162f48ce');\nhashMap.set('asdf','b2acfc0a6164e9a279daa724777c423f84572dafb0df09b1b0cf6f205f9eb6d0');\nhashMap.set('azure-pipelines','4f635b0ecd388ee266d992e8281fd40e3db2f5867d86fc1cbce72dc33a66e796');\nhashMap.set('batect','bd9208444eff1a4958061484db66a47b616c31f15a8d49d23b75c4560fcee83e');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','4994a8bd86d5bfb169d67c08efd8509b58c368c2bf3dd9bbe42553c0fabc3f1a');\nhashMap.set('bazel-module','40f6a862b4e72fcc7262ee41f8b570ea3fd5600d6d552b94ed3301bb201f5db5');\nhashMap.set('bazelisk','d71489650feefb0dbbe7461f924cb50e41c8eef8fe2e11acdec2d42d0212c8ef');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','a93effb1f1c5d65b3277c3b4709924eacde282e8efd028a8e3d8c1ce3ef69407');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','691aa0bd20c20f7e05be5d231ed14dccdf81b9399d062448794176403aa53d94');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','4f70ac0377893683eb30013bf4d23a8bd7213a883847c9eaadf1217f5f190ee1');\nhashMap.set('cake','ed6d14c96161f1d3d927adc7e333b96585164e1f25151a87990914d57ae17fe1');\nhashMap.set('cargo','13377c53df158cdfc58330f73682fadc3e88e57f0d22c9245c0ffd62a495edf1');\nhashMap.set('cdnurl','d3edf6cdc38e92eb43ff5a2b4e8df6a6a13154cf83244725c39e28d7e6ea9177');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','8c0c739f7e4082bbfe8e3fdffebaf43e26f70a1314d95b306e9b93e4f4297886');\nhashMap.set('cocoapods','cf48ab5a573a28bf14d5e6c84eed9ca08b7f0cb5b7fc51d795c21c7254bb9dd1');\nhashMap.set('composer','869aab556d9b2ca2b743a790a7c0d7d104d62bbcbcc2185c44c64543d70413ba');\nhashMap.set('conan','74ca922a0ffdf1a9dd44b83eb2b3a36c56c7d792031e3a4a484f293046be3ecd');\nhashMap.set('copier','06a52206ba5542f99f056c832245196afd4b78bffeca088f710a5df958a9693d');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','a43016a9a469e0472f00855c8db64bb65ef5ffa773e7bbfade02a21400f67690');\nhashMap.set('deps-edn','c87dd5e88587147ad1a78f047b814f3c4aa60d6de30d0c49d849391eeaf1b64c');\nhashMap.set('devbox','a608d1e6db93a8f997d41f8dee7b67533452a956057865978342e2819272e0a9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','5441af5b5abf8d347e46002d47f02f85743401bda28232f49fb7b3bbb772a4fb');\nhashMap.set('dockerfile','54122792bf8ea0be98e0a0716e627e3115b40a5f0155ccd7ae0cfc52424a3478');\nhashMap.set('droneci','237c8de87b9bf653fb943b56e84e99c45f6d86ae27d86e599b3f3f99c35ba8ee');\nhashMap.set('fleet','d73d5d35f10df0599a561d9c8d25f3935350407d0e3bd3a1d1545295f278912e');\nhashMap.set('flux','70833dd068ea0a746a9392469e7904021562c7629428d0cd554603bad4eb6ce5');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','e95bbc9b69a36dee82e255e8983640b7179cb5f17d24b035c6cf01d9635b35bd');\nhashMap.set('github-actions','0a77751d4307d7e923bf2d05bf49084e77a23d7f1e498a1373202dd1ebdcc48a');\nhashMap.set('gitlabci','33c264edf7837fb8fbc4cf0078c8bd2d5a75431039b1db65bf47356df7753125');\nhashMap.set('gitlabci-include','ef696c478c2ac1723b3aca070ba9779be0e702fff0844054251ba0029523d0eb');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','02389785183c39d2896d7893414c5e1060023f95c1fe7b595bd06cc5c1186d39');\nhashMap.set('gomod','7e9befd57c32420da2061445defde5a02bebf4898bef0106614bab95a8713a2f');\nhashMap.set('gradle','550f1107f0ac27d18fa76a7d5c0c0b317b5df4156fc12cfd378573ccfe26fca0');\nhashMap.set('gradle-wrapper','799d9bb8d9dead673fb513ba4936395f14da30897d33a9df46b3266e1b835d5d');\nhashMap.set('haskell-cabal','f232d0e883235f74ed71fd9de4a7468e5fcbda9a1af5beb56c24657f7bf2e891');\nhashMap.set('helm-requirements','4d90e5e18a380876ad48e21e1ad88ea62e25d973a1ddaa3763447fc0a9f9915b');\nhashMap.set('helm-values','b5c52c6a27d805557418c585c5d3030c95ee641d53057021f3fe060f81b6e1af');\nhashMap.set('helmfile','ab828a1877cfe029ed5f8dd2a026409cd5e6431705af3aac3f56a3bc4f827508');\nhashMap.set('helmsman','ef9680c612f702c7f07aea9b6e5d811e91214dcfa5755c9f3803e9528090935e');\nhashMap.set('helmv3','4088a90bd8be4ae1bcb85dc4d34d3fbbb75e72bd33d144284e7e1f0e726c8d3b');\nhashMap.set('hermit','61e132cfccbe4e3884801a3728f3391455c214811a33c1f733b0dea7122bbbb6');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','9c64a4f1475b1c2052372e566c9190f32ae8acd1c54313031d55ae8772388367');\nhashMap.set('html','67c5f3c5c58e96f5dd257ba5987d900cf7fef81d667c3640e96c847b37de35a8');\nhashMap.set('jenkins','268ebfc8a1caf3edeb2192c2b1b2fa4bf18a78a3e731ba20a6c104940a5539f3');\nhashMap.set('jsonnet-bundler','4023ef4cac55fe58f8d9744ae86b13532298926e35e22d250334cde55c3386ff');\nhashMap.set('kotlin-script','99ef296792a0ca575ed31d3defb514b05a58083dc01c52ea0890c69d867ba1dd');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','fb5f6fbf45b318ca277d6d9f7fee22680f4b99c7ff9170a50315122918d2e007');\nhashMap.set('leiningen','133fca2c3423f53f2ccc22518153ddbcafbf0f4812376c77e952eb3d24d81f85');\nhashMap.set('maven','f084cdc88320ca1e82af957d0008e7c9ce991d3282cb428f3108a5722239cead');\nhashMap.set('maven-wrapper','779344a4e259e0c28bfadfeb435dd72feb7224d7346d038a1c35f02deb1357bc');\nhashMap.set('meteor','4a93a326b27bedfe52118e27e06f39fecd7c55bd4cd7fccec4cb120cac14cec4');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','8463d355091f5f167e3f4a8adbebfe49310ad9ac45c89d60455ef8e110df4a49');\nhashMap.set('mix','5eb001e2af7cd664d811ad2d9928bf785527ed292de1e567de57f7e2cecc1ecc');\nhashMap.set('nix','d3283c2b948695a16c1089da4e2689faacd50eaa7d734d6fa5d6661aef6db7e7');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','95ddcec26d4db9ee54028f00fdcac118c458cd1513623737dd1b3f79d05a11a4');\nhashMap.set('nuget','d4f3c5cbc0f6e6e8baf80b8ad8e184d186ff6686486b1c97995a0c87151abbe3');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','32233a1a8a2725699d7448ba438e3d0b78141f7799cd2b588de278d41e26ed10');\nhashMap.set('pep621','f5dc3c8434845dd814bc649c619323dcb69e3ec5da2d361d353bdf6ae3cc5d88');\nhashMap.set('pep723','b96683163de63ed93207ec0538066705b1e58a1cd5b8bd11c63fc28b26bddba1');\nhashMap.set('pip-compile','9711b1c00da18ff785e624c50e4b042519e7ad615c5f018f08459fac8394fec5');\nhashMap.set('pip_requirements','537ef9d7b43b5adcfbfbb86392e0c7a8a0ee91c804118af83cf92e1868949e1a');\nhashMap.set('pip_setup','0175fe550c19d9bd31c978bd83fdc088cb40fcacd5d6751f640164274ae64e61');\nhashMap.set('pipenv','a7d45859427263c17f1109a08c8b48a1f24812290f9853013ec1774f2484a769');\nhashMap.set('pixi','3732f052617efd5007ddbe31091a2ba026909288bac4cbbe6d2bd6ac64d85393');\nhashMap.set('poetry','6cf6bc5116458761b2d6779caf465d6e26768fbe6e2ffba54b5da981aa8c385f');\nhashMap.set('pre-commit','17a5f183985ebffe98785a541d3609bf25efedc387deb3d50e9f00f02b25f615');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','a2ded51959d48e053b811b3b9330b2460fc61d0fc2e74a400a546e4f82d25767');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','e1fc88a4e14cd595e89bb3d79b4adf2add3ce5eb80f75276e712c32598cca53d');\nhashMap.set('renovate-config','ca60beee2e3b871ea1216fa9df9a501f7ed355fe7da29e12509e56a124a78e69');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e508c2e2fb8d44e6cbec20f449c8eed096728566e6058187269c637930d388fb');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','7dea08c5708625e753bd56918bc214df7fb4d8543a26e936926a21ab43b5f785');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','05b3158e88771ed4629e171592cf4f1bf0ff342f8aeae89be0b340c630cc6d8e');\nhashMap.set('swift','eb5f7c3c4dabf28eed36916269ca9be16ab9ddb83993db03ea66b9195ad7bdc6');\nhashMap.set('tekton','fdc5b9b5edec2a90cda2f858f3ebc532aa8efb1187d1e0b7c89b07796e9cb6cd');\nhashMap.set('terraform','73f9d1753d1077585bd264163b7bfacaf6cf20b586b233cbb8cf058a9fce0103');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','ffcbaa67dd65f064d43f8c121c1006115eab1879c4bd38de263b9b90a009c118');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','31247d37bc80aae17039bfa21bd989c5717730c5ef10cf2a6f09841576d012ec');\nhashMap.set('travis','bb482a0195cd009ec3896a6227bb95617f5c84bedb518c7d971e50c62235d9ca');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','ee9cc316c73ab0944da494bf36cfeafba8e79a36ec77753b9f341c8e80f1d602');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d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AQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,qBAAoB,kEAAkE;AAClG,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,sBAAqB,kEAAkE;AACnG,QAAQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
|
|
1
|
+
{"version":3,"file":"fingerprint.generated.js","names":[],"sources":["../../../lib/modules/manager/fingerprint.generated.ts"],"sourcesContent":["export const hashMap = new Map<string, string>();\n\nhashMap.set('ansible','1d3568f42393d697f8f96d461b72077ee7a1044b654e87667a12f861b3083111');\nhashMap.set('ansible-galaxy','8226d47128f2018825d4d6f84794e3183eb79c706045fa7e88491edd5e64106f');\nhashMap.set('ant','2df5943cf0ed19a21b94df13729dbb925655548130caf37e3e22bebaed518e17');\nhashMap.set('argocd','5d35b1992e53130bf83b0e59a0f90ccd3a78919974c69044f306dc5d162f48ce');\nhashMap.set('asdf','b2acfc0a6164e9a279daa724777c423f84572dafb0df09b1b0cf6f205f9eb6d0');\nhashMap.set('azure-pipelines','4f635b0ecd388ee266d992e8281fd40e3db2f5867d86fc1cbce72dc33a66e796');\nhashMap.set('batect','bd9208444eff1a4958061484db66a47b616c31f15a8d49d23b75c4560fcee83e');\nhashMap.set('batect-wrapper','d999355511ea7f4053325a18b8cfc8d2b586c61e6760c35e557d383a673e3939');\nhashMap.set('bazel','4994a8bd86d5bfb169d67c08efd8509b58c368c2bf3dd9bbe42553c0fabc3f1a');\nhashMap.set('bazel-module','40f6a862b4e72fcc7262ee41f8b570ea3fd5600d6d552b94ed3301bb201f5db5');\nhashMap.set('bazelisk','d71489650feefb0dbbe7461f924cb50e41c8eef8fe2e11acdec2d42d0212c8ef');\nhashMap.set('bicep','7246e0bfc06e0e28cbb03ac088c5591f648956b086e106aeb251fe5d628329db');\nhashMap.set('bitbucket-pipelines','59c0503494ab1442b127914503c01b97ac17b6742b19c632292d5aa24de115cd');\nhashMap.set('bitrise','478dfd316221fad7c29e177c70d1018d832fb2626b53308a5d0f1f0380e69f42');\nhashMap.set('buildkite','a93effb1f1c5d65b3277c3b4709924eacde282e8efd028a8e3d8c1ce3ef69407');\nhashMap.set('buildpacks','6bef3cb04d66b5cfbb195adb4829bcbccae6408518706744d291bacf0610421f');\nhashMap.set('bun','691aa0bd20c20f7e05be5d231ed14dccdf81b9399d062448794176403aa53d94');\nhashMap.set('bun-version','df3ae8e4a5de1fa1b4544f3d7fc8117e80adb1e151c46d1ede54a4dbea6521e4');\nhashMap.set('bundler','4f70ac0377893683eb30013bf4d23a8bd7213a883847c9eaadf1217f5f190ee1');\nhashMap.set('cake','ed6d14c96161f1d3d927adc7e333b96585164e1f25151a87990914d57ae17fe1');\nhashMap.set('cargo','13377c53df158cdfc58330f73682fadc3e88e57f0d22c9245c0ffd62a495edf1');\nhashMap.set('cdnurl','d3edf6cdc38e92eb43ff5a2b4e8df6a6a13154cf83244725c39e28d7e6ea9177');\nhashMap.set('circleci','91cbeb33ea20f9838e2c81a1195eb806f0b38fa282bc3679f62552f20575ca85');\nhashMap.set('cloudbuild','8c0c739f7e4082bbfe8e3fdffebaf43e26f70a1314d95b306e9b93e4f4297886');\nhashMap.set('cocoapods','cf48ab5a573a28bf14d5e6c84eed9ca08b7f0cb5b7fc51d795c21c7254bb9dd1');\nhashMap.set('composer','869aab556d9b2ca2b743a790a7c0d7d104d62bbcbcc2185c44c64543d70413ba');\nhashMap.set('conan','74ca922a0ffdf1a9dd44b83eb2b3a36c56c7d792031e3a4a484f293046be3ecd');\nhashMap.set('copier','06a52206ba5542f99f056c832245196afd4b78bffeca088f710a5df958a9693d');\nhashMap.set('cpanfile','07813fec3f3c2197056500e9266a0553b9774c02f2c74d5ca2e213188c7c12d3');\nhashMap.set('crossplane','5c26b1201a1a51454ffb94d829e223a76a781569bf79cdb1e47087c30233ec40');\nhashMap.set('crow','eb9a5f9f95041855dded67bcce3dd54724f690995ed6268d272e8a666ff28fd0');\nhashMap.set('deno','a43016a9a469e0472f00855c8db64bb65ef5ffa773e7bbfade02a21400f67690');\nhashMap.set('deps-edn','c87dd5e88587147ad1a78f047b814f3c4aa60d6de30d0c49d849391eeaf1b64c');\nhashMap.set('devbox','a608d1e6db93a8f997d41f8dee7b67533452a956057865978342e2819272e0a9');\nhashMap.set('devcontainer','24320ed1cb6191d04cb8b2707214d82c08c682597aed1d84f250aa00ad1632ec');\nhashMap.set('docker-compose','5441af5b5abf8d347e46002d47f02f85743401bda28232f49fb7b3bbb772a4fb');\nhashMap.set('dockerfile','54122792bf8ea0be98e0a0716e627e3115b40a5f0155ccd7ae0cfc52424a3478');\nhashMap.set('droneci','237c8de87b9bf653fb943b56e84e99c45f6d86ae27d86e599b3f3f99c35ba8ee');\nhashMap.set('fleet','d73d5d35f10df0599a561d9c8d25f3935350407d0e3bd3a1d1545295f278912e');\nhashMap.set('flux','70833dd068ea0a746a9392469e7904021562c7629428d0cd554603bad4eb6ce5');\nhashMap.set('fvm','9b161df0f14bc6e536368952adf373e343630097121a913cea60ee284027fb90');\nhashMap.set('git-submodules','e95bbc9b69a36dee82e255e8983640b7179cb5f17d24b035c6cf01d9635b35bd');\nhashMap.set('github-actions','0a77751d4307d7e923bf2d05bf49084e77a23d7f1e498a1373202dd1ebdcc48a');\nhashMap.set('gitlabci','33c264edf7837fb8fbc4cf0078c8bd2d5a75431039b1db65bf47356df7753125');\nhashMap.set('gitlabci-include','ef696c478c2ac1723b3aca070ba9779be0e702fff0844054251ba0029523d0eb');\nhashMap.set('glasskube','93e7b9000a17efa15a1abaaf320b5af9169b1ecd828fc0c881d98570ef9d9e30');\nhashMap.set('gleam','02389785183c39d2896d7893414c5e1060023f95c1fe7b595bd06cc5c1186d39');\nhashMap.set('gomod','64ab863d3064caf535e5e85d5f1c18275f5b9471950a342b2804b35d8da1319f');\nhashMap.set('gradle','550f1107f0ac27d18fa76a7d5c0c0b317b5df4156fc12cfd378573ccfe26fca0');\nhashMap.set('gradle-wrapper','799d9bb8d9dead673fb513ba4936395f14da30897d33a9df46b3266e1b835d5d');\nhashMap.set('haskell-cabal','f232d0e883235f74ed71fd9de4a7468e5fcbda9a1af5beb56c24657f7bf2e891');\nhashMap.set('helm-requirements','4d90e5e18a380876ad48e21e1ad88ea62e25d973a1ddaa3763447fc0a9f9915b');\nhashMap.set('helm-values','b5c52c6a27d805557418c585c5d3030c95ee641d53057021f3fe060f81b6e1af');\nhashMap.set('helmfile','ab828a1877cfe029ed5f8dd2a026409cd5e6431705af3aac3f56a3bc4f827508');\nhashMap.set('helmsman','ef9680c612f702c7f07aea9b6e5d811e91214dcfa5755c9f3803e9528090935e');\nhashMap.set('helmv3','4088a90bd8be4ae1bcb85dc4d34d3fbbb75e72bd33d144284e7e1f0e726c8d3b');\nhashMap.set('hermit','61e132cfccbe4e3884801a3728f3391455c214811a33c1f733b0dea7122bbbb6');\nhashMap.set('homeassistant-manifest','05043c6db870cffbb6f8f3e351c025e3de227eaae0b24134b796aec46f84b65f');\nhashMap.set('homebrew','9c64a4f1475b1c2052372e566c9190f32ae8acd1c54313031d55ae8772388367');\nhashMap.set('html','67c5f3c5c58e96f5dd257ba5987d900cf7fef81d667c3640e96c847b37de35a8');\nhashMap.set('jenkins','268ebfc8a1caf3edeb2192c2b1b2fa4bf18a78a3e731ba20a6c104940a5539f3');\nhashMap.set('jsonnet-bundler','4023ef4cac55fe58f8d9744ae86b13532298926e35e22d250334cde55c3386ff');\nhashMap.set('kotlin-script','99ef296792a0ca575ed31d3defb514b05a58083dc01c52ea0890c69d867ba1dd');\nhashMap.set('kubernetes','321e7d77fb3600dd4c00a86eaa1294927e7f92300b74fa2977d813dcaa3bb4de');\nhashMap.set('kustomize','fb5f6fbf45b318ca277d6d9f7fee22680f4b99c7ff9170a50315122918d2e007');\nhashMap.set('leiningen','133fca2c3423f53f2ccc22518153ddbcafbf0f4812376c77e952eb3d24d81f85');\nhashMap.set('maven','f084cdc88320ca1e82af957d0008e7c9ce991d3282cb428f3108a5722239cead');\nhashMap.set('maven-wrapper','779344a4e259e0c28bfadfeb435dd72feb7224d7346d038a1c35f02deb1357bc');\nhashMap.set('meteor','4a93a326b27bedfe52118e27e06f39fecd7c55bd4cd7fccec4cb120cac14cec4');\nhashMap.set('mint','248fe4f1ea5c985921c286785792c97e06fc41f402b2d45df82f6aecd17f710e');\nhashMap.set('mise','8463d355091f5f167e3f4a8adbebfe49310ad9ac45c89d60455ef8e110df4a49');\nhashMap.set('mix','5eb001e2af7cd664d811ad2d9928bf785527ed292de1e567de57f7e2cecc1ecc');\nhashMap.set('nix','d3283c2b948695a16c1089da4e2689faacd50eaa7d734d6fa5d6661aef6db7e7');\nhashMap.set('nodenv','ac652c28481b001f7471f4183eac07b45d98ecbe83efc275830b0a1b2e0459b8');\nhashMap.set('npm','95ddcec26d4db9ee54028f00fdcac118c458cd1513623737dd1b3f79d05a11a4');\nhashMap.set('nuget','d4f3c5cbc0f6e6e8baf80b8ad8e184d186ff6686486b1c97995a0c87151abbe3');\nhashMap.set('nvm','3eb77c7b0acf6d64753de78fad2499b352719853aa6872878c40675d14152322');\nhashMap.set('ocb','032b216684c14b0954e0bb019513a2aca3faaee5748587acb668d377d7c891ca');\nhashMap.set('osgi','32233a1a8a2725699d7448ba438e3d0b78141f7799cd2b588de278d41e26ed10');\nhashMap.set('pep621','f5dc3c8434845dd814bc649c619323dcb69e3ec5da2d361d353bdf6ae3cc5d88');\nhashMap.set('pep723','b96683163de63ed93207ec0538066705b1e58a1cd5b8bd11c63fc28b26bddba1');\nhashMap.set('pip-compile','9711b1c00da18ff785e624c50e4b042519e7ad615c5f018f08459fac8394fec5');\nhashMap.set('pip_requirements','537ef9d7b43b5adcfbfbb86392e0c7a8a0ee91c804118af83cf92e1868949e1a');\nhashMap.set('pip_setup','0175fe550c19d9bd31c978bd83fdc088cb40fcacd5d6751f640164274ae64e61');\nhashMap.set('pipenv','a7d45859427263c17f1109a08c8b48a1f24812290f9853013ec1774f2484a769');\nhashMap.set('pixi','3732f052617efd5007ddbe31091a2ba026909288bac4cbbe6d2bd6ac64d85393');\nhashMap.set('poetry','6cf6bc5116458761b2d6779caf465d6e26768fbe6e2ffba54b5da981aa8c385f');\nhashMap.set('pre-commit','17a5f183985ebffe98785a541d3609bf25efedc387deb3d50e9f00f02b25f615');\nhashMap.set('proto','412053d4550026b4ace490b46e970915b87ec1abf0b0a0c6c8c58ccf1fc16843');\nhashMap.set('pub','a2ded51959d48e053b811b3b9330b2460fc61d0fc2e74a400a546e4f82d25767');\nhashMap.set('puppet','ba58ab689e44acc8f61c3569ab8b40fde01b8a9d3aad712708e2a419e57d8b45');\nhashMap.set('pyenv','9ede8becc97774f9040b40f4472d3e933534b596e04c360bfe0f3c6f95f25182');\nhashMap.set('quadlet','e1fc88a4e14cd595e89bb3d79b4adf2add3ce5eb80f75276e712c32598cca53d');\nhashMap.set('renovate-config','ca60beee2e3b871ea1216fa9df9a501f7ed355fe7da29e12509e56a124a78e69');\nhashMap.set('ruby-version','2db2140d9eee8c555e729a4de0396fa2d78846d3149890ee12fa515bd654be97');\nhashMap.set('runtime-version','b582b168c0cc595e39010feb10f4b97a82683eb269e9598216fbb11cc186e160');\nhashMap.set('rust-toolchain','6ace53db02874d73620d2d872291839820a512a9529c42d174358c692e5db720');\nhashMap.set('sbt','e508c2e2fb8d44e6cbec20f449c8eed096728566e6058187269c637930d388fb');\nhashMap.set('scalafmt','9d36159b56835e96498af026a1fb0543200db0581681ef95ec54988f411e180f');\nhashMap.set('setup-cfg','7dea08c5708625e753bd56918bc214df7fb4d8543a26e936926a21ab43b5f785');\nhashMap.set('smithy','9641b91d065ffb63be0dd888139a0402dba41e550f8b44c592db9daf52109100');\nhashMap.set('sveltos','05b3158e88771ed4629e171592cf4f1bf0ff342f8aeae89be0b340c630cc6d8e');\nhashMap.set('swift','eb5f7c3c4dabf28eed36916269ca9be16ab9ddb83993db03ea66b9195ad7bdc6');\nhashMap.set('tekton','fdc5b9b5edec2a90cda2f858f3ebc532aa8efb1187d1e0b7c89b07796e9cb6cd');\nhashMap.set('terraform','73f9d1753d1077585bd264163b7bfacaf6cf20b586b233cbb8cf058a9fce0103');\nhashMap.set('terraform-version','ec8f786b9731d47f2c2fe0307caf64d7ddd83046fe7ff1f7d8423239f8b0f2aa');\nhashMap.set('terragrunt','ffcbaa67dd65f064d43f8c121c1006115eab1879c4bd38de263b9b90a009c118');\nhashMap.set('terragrunt-version','eea6087b33717d22ede2fc68c2f64df8390b75abe82110ed831a180648feb51d');\nhashMap.set('tflint-plugin','31247d37bc80aae17039bfa21bd989c5717730c5ef10cf2a6f09841576d012ec');\nhashMap.set('travis','bb482a0195cd009ec3896a6227bb95617f5c84bedb518c7d971e50c62235d9ca');\nhashMap.set('typst','d080a79fbd961c6e21fcc505d544b7e0ff2126142acb1dcabdf6abbcd9339248');\nhashMap.set('unity3d','f13e25e115e3443f4e16cf31578acffa78fb1a5e23339680a92d8d6de6052920');\nhashMap.set('velaci','fda00ddb7cc23e9a37e0a8a253151df0a6930b4276d3e4f78cc54b9ac09af7de');\nhashMap.set('vendir','ee9cc316c73ab0944da494bf36cfeafba8e79a36ec77753b9f341c8e80f1d602');\nhashMap.set('woodpecker','6110d3bec33aaeb3511d4bbfa896cec3c8e02fb04a6cff50c9ba81061c851045');\nhashMap.set('xcodegen','dad511d88a9ce1dbdde8b9731f3da7f2bdaa4ca8a083294ee58d56da62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AAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,aAAY,kEAAkE;AAC1F,QAAQ,IAAI,qBAAoB,kEAAkE;AAClG,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,sBAAqB,kEAAkE;AACnG,QAAQ,IAAI,iBAAgB,kEAAkE;AAC9F,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,SAAQ,kEAAkE;AACtF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,UAAS,kEAAkE;AACvF,QAAQ,IAAI,cAAa,kEAAkE;AAC3F,QAAQ,IAAI,YAAW,kEAAkE;AACzF,QAAQ,IAAI,WAAU,kEAAkE;AACxF,QAAQ,IAAI,SAAQ,kEAAkE"}
|
|
@@ -1337,7 +1337,7 @@ async function mergePr({ branchName, id: prNo, strategy }) {
|
|
|
1337
1337
|
logger.debug({ response: body }, `GitHub blocking PR merge -- Missing required status check(s)`);
|
|
1338
1338
|
return false;
|
|
1339
1339
|
}
|
|
1340
|
-
if (isNonEmptyString(body?.message) && (body.message.includes("approving review") || body.message.includes("code owner review"))) {
|
|
1340
|
+
if (isNonEmptyString(body?.message) && (body.message.includes("approving review") || body.message.includes("code owner review") || body.message.includes("New changes require approval from someone other than the last pusher"))) {
|
|
1341
1341
|
logger.debug({ response: body }, `GitHub blocking PR merge -- Needs approving review(s)`);
|
|
1342
1342
|
return false;
|
|
1343
1343
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["hostRules.find","Issue","git.initRepo","git.getBranchCommit","git.forcePushToRemote","git.prepareCommit","git.resetToCommit","git.fetchBranch"],"sources":["../../../../lib/modules/platform/github/index.ts"],"sourcesContent":["import { setTimeout } from 'node:timers/promises';\nimport { isArray, isNonEmptyObject, isNonEmptyString } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport {\n PLATFORM_INTEGRATION_UNAUTHORIZED,\n PLATFORM_RATE_LIMIT_EXCEEDED,\n PLATFORM_UNKNOWN_ERROR,\n PR_ALREADY_IN_MERGE_QUEUE,\n REPOSITORY_ACCESS_FORBIDDEN,\n REPOSITORY_ARCHIVED,\n REPOSITORY_BLOCKED,\n REPOSITORY_CANNOT_FORK,\n REPOSITORY_CHANGED,\n REPOSITORY_DISABLED,\n REPOSITORY_EMPTY,\n REPOSITORY_FORKED,\n REPOSITORY_FORK_MISSING,\n REPOSITORY_FORK_MODE_FORKED,\n REPOSITORY_NOT_FOUND,\n REPOSITORY_RENAMED,\n} from '../../../constants/error-messages.ts';\nimport { instrument } from '../../../instrumentation/index.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport type { BranchStatus } from '../../../types/index.ts';\nimport { isGithubFineGrainedPersonalAccessToken } from '../../../util/check-token.ts';\nimport { coerceToNull } from '../../../util/coerce.ts';\nimport { parseJson } from '../../../util/common.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { formatCommitMessage } from '../../../util/git/commit-trailers.ts';\nimport * as git from '../../../util/git/index.ts';\nimport {\n diffCommitTree,\n getCommitTreeSha,\n pushCommitToRenovateRef,\n} from '../../../util/git/index.ts';\nimport type {\n CommitFilesConfig,\n CommitResult,\n} from '../../../util/git/types.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { memCacheProvider } from '../../../util/http/cache/memory-http-cache-provider.ts';\nimport { repoCacheProvider } from '../../../util/http/cache/repository-http-cache-provider.ts';\nimport type { GithubHttpOptions } from '../../../util/http/github.ts';\nimport * as githubHttp from '../../../util/http/github.ts';\nimport type { HttpResponse } from '../../../util/http/types.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { sanitize } from '../../../util/sanitize.ts';\nimport type { LongCommitSha } from '../../../util/schema-utils/git.ts';\nimport { toLongCommitSha } from '../../../util/schema-utils/git.ts';\nimport { fromBase64, looseEquals } from '../../../util/string.ts';\nimport { ensureTrailingSlash, isHttpUrl, parseUrl } from '../../../util/url.ts';\nimport { incLimitedValue } from '../../../workers/global/limits.ts';\nimport { normalizePythonDepName } from '../../datasource/pypi/common.ts';\nimport type {\n AutodiscoverConfig,\n BranchStatusConfig,\n CreatePRConfig,\n EnsureCommentConfig,\n EnsureCommentRemovalConfig,\n EnsureIssueConfig,\n EnsureIssueResult,\n FindPRConfig,\n MergePRConfig,\n PlatformParams,\n PlatformPrOptions,\n PlatformResult,\n Pr,\n ReattemptPlatformAutomergeConfig,\n RepoParams,\n RepoResult,\n UpdatePrConfig,\n} from '../types.ts';\nimport { repoFingerprint } from '../util.ts';\nimport { smartTruncate } from '../utils/pr-body.ts';\nimport { remoteBranchExists } from './branch.ts';\nimport { coerceRestPr, githubApi, mapMergeStartegy } from './common.ts';\nimport {\n enableAutoMergeMutation,\n getIssuesQuery,\n repoInfoQuery,\n repoMergeQueueQuery,\n} from './graphql.ts';\nimport { GithubIssueCache } from './issue.ts';\nimport { massageMarkdownLinks } from './massage-markdown-links.ts';\nimport { getPrCache, isPrInMergeQueue, updatePrCache } from './pr.ts';\nimport {\n GithubBranchProtection,\n GithubBranchRulesets,\n GithubVulnerabilityAlerts,\n GithubIssue as Issue,\n} from './schema.ts';\nimport type {\n AggregatedVulnerabilities,\n CombinedBranchStatus,\n Comment,\n GhAutomergeResponse,\n GhBranchStatus,\n GhPr,\n GhRepo,\n GhRestPr,\n GhRestRepo,\n LocalRepoConfig,\n PlatformConfig,\n} from './types.ts';\nimport { getAppDetails, getUserDetails, getUserEmail } from './user.ts';\nimport { getRepoUrl, warnIfDefaultGitAuthorEmail } from './utils.ts';\n\nexport const id = 'github';\n\nlet config: LocalRepoConfig;\nlet platformConfig: PlatformConfig;\n\n// GitHub's max is 60k but in the hosted app we've observed that content-length is ~1k longer\nconst GitHubMaxPrBodyLen = 58000;\n\nexport function resetConfigs(): void {\n config = {} as never;\n platformConfig = {\n hostType: 'github',\n endpoint: 'https://api.github.com/',\n };\n}\n\nresetConfigs();\n\nfunction escapeHash(input: string): string {\n return input?.replace(regEx(/#/g), '%23');\n}\n\nexport function isGHApp(): boolean {\n return !!platformConfig.isGHApp;\n}\n\nexport async function detectGhe(token: string): Promise<void> {\n const parsedEndpoint = parseUrl(platformConfig.endpoint);\n /* v8 ignore next -- endpoint is validated in initPlatform before detectGhe is called */\n if (!parsedEndpoint) {\n throw new Error(`Invalid GitHub endpoint: ${platformConfig.endpoint}`);\n }\n const host = parsedEndpoint.host;\n platformConfig.isGhe = host !== 'api.github.com';\n platformConfig.isGheCloud = host.endsWith('.ghe.com');\n if (platformConfig.isGhe) {\n const gheHeaderKey = 'x-github-enterprise-version';\n const gheQueryRes = await githubApi.headJson('/', { token });\n const gheHeaders = coerceObject(gheQueryRes?.headers);\n const [, gheVersion] =\n Object.entries(gheHeaders).find(\n ([k]) => k.toLowerCase() === gheHeaderKey,\n ) ?? [];\n platformConfig.gheVersion = semver.valid(gheVersion as string) ?? null;\n logger.debug(\n `Detected GitHub Enterprise Server, version: ${platformConfig.gheVersion}`,\n );\n }\n}\n\nexport async function initPlatform({\n endpoint,\n token: originalToken,\n username,\n gitAuthor,\n}: PlatformParams): Promise<PlatformResult> {\n let token = originalToken;\n if (!token) {\n throw new Error('Init: You must configure a GitHub token');\n }\n token = token.replace(regEx(/^ghs_/), 'x-access-token:ghs_');\n platformConfig.isGHApp = token.startsWith('x-access-token:');\n\n if (endpoint) {\n if (!isHttpUrl(endpoint)) {\n throw new Error(`Init: Invalid GitHub endpoint URL: ${endpoint}`);\n }\n platformConfig.endpoint = ensureTrailingSlash(endpoint);\n githubHttp.setBaseUrl(platformConfig.endpoint);\n } else {\n logger.debug(`Using default github endpoint: ${platformConfig.endpoint}`);\n }\n\n await detectGhe(token);\n /**\n * GHE requires version >=3.10 to support fine-grained access tokens\n * https://docs.github.com/en/enterprise-server@3.10/admin/release-notes#authentication\n */\n if (\n isGithubFineGrainedPersonalAccessToken(token) &&\n platformConfig.isGhe &&\n (!platformConfig.gheVersion ||\n semver.lt(platformConfig.gheVersion, '3.10.0'))\n ) {\n throw new Error(\n 'Init: Fine-grained Personal Access Tokens do not support GitHub Enterprise Server API version <3.10 and cannot be used with Renovate.',\n );\n }\n\n let renovateUsername: string;\n if (username) {\n renovateUsername = username;\n } else if (platformConfig.isGHApp) {\n platformConfig.userDetails ??= await getAppDetails(token);\n renovateUsername = platformConfig.userDetails.username;\n } else {\n platformConfig.userDetails ??= await getUserDetails(\n platformConfig.endpoint,\n token,\n );\n renovateUsername = platformConfig.userDetails.username;\n }\n\n let ghHostname: string;\n /* v8 ignore next -- false negative due to V8/source-map artifact */\n if (platformConfig.isGheCloud) {\n ghHostname = 'ghe.com';\n } else if (platformConfig.isGhe) {\n // valid url ensured at the function start\n const parsedEndpoint = parseUrl(platformConfig.endpoint)!;\n ghHostname = parsedEndpoint.hostname;\n } else {\n ghHostname = 'github.com';\n }\n\n let discoveredGitAuthor: string | undefined;\n if (!gitAuthor) {\n if (platformConfig.isGHApp) {\n platformConfig.userDetails ??= await getAppDetails(token);\n discoveredGitAuthor = `${platformConfig.userDetails.name} <${platformConfig.userDetails.id}+${platformConfig.userDetails.username}@users.noreply.${ghHostname}>`;\n } else {\n platformConfig.userDetails ??= await getUserDetails(\n platformConfig.endpoint,\n token,\n );\n // v8 ignore next -- TODO: coverage error #40625\n platformConfig.userEmail =\n platformConfig.userDetails.email ??\n (await getUserEmail(platformConfig.endpoint, token));\n if (platformConfig.userEmail) {\n discoveredGitAuthor = `${platformConfig.userDetails.name} <${platformConfig.userEmail}>`;\n }\n }\n }\n\n git.setPlatformIgnoredAuthors([`noreply@${ghHostname}`]);\n\n logger.debug({ platformConfig, renovateUsername }, 'Platform config');\n const platformResult: PlatformResult = {\n endpoint: platformConfig.endpoint,\n gitAuthor: gitAuthor ?? discoveredGitAuthor,\n renovateUsername,\n token,\n };\n\n warnIfDefaultGitAuthorEmail(platformResult.gitAuthor, platformConfig.isGhe);\n\n if (\n getEnv().RENOVATE_X_GITHUB_HOST_RULES &&\n platformResult.endpoint === 'https://api.github.com/'\n ) {\n logger.debug('Adding GitHub token as GHCR password');\n platformResult.hostRules = [\n {\n matchHost: 'ghcr.io',\n hostType: 'docker',\n username: 'USERNAME',\n password: token.replace(regEx(/^x-access-token:/), ''),\n },\n ];\n logger.debug('Adding GitHub token as npm.pkg.github.com Basic token');\n platformResult.hostRules.push({\n matchHost: 'npm.pkg.github.com',\n hostType: 'npm',\n token: token.replace(regEx(/^x-access-token:/), ''),\n });\n const usernamePasswordHostTypes = ['rubygems', 'maven', 'nuget'];\n for (const hostType of usernamePasswordHostTypes) {\n logger.debug(\n `Adding GitHub token as ${hostType}.pkg.github.com password`,\n );\n platformResult.hostRules.push({\n hostType,\n matchHost: `${hostType}.pkg.github.com`,\n username: renovateUsername,\n password: token.replace(regEx(/^x-access-token:/), ''),\n });\n }\n }\n return platformResult;\n}\n\nasync function fetchRepositories(): Promise<GhRestRepo[]> {\n try {\n if (isGHApp()) {\n const res = await githubApi.getJsonUnchecked<{\n repositories: GhRestRepo[];\n }>(`installation/repositories?per_page=100`, {\n paginationField: 'repositories',\n paginate: 'all',\n });\n return res.body.repositories;\n }\n const res = await githubApi.getJsonUnchecked<GhRestRepo[]>(\n `user/repos?per_page=100`,\n { paginate: 'all' },\n );\n return res.body;\n } catch (err) /* v8 ignore next -- defensive: repo listing failures are logged and rethrown, not simulated in specs */ {\n logger.error({ err }, `GitHub getRepos error`);\n throw err;\n }\n}\n\n// Get all repositories that the user has access to\nexport async function getRepos(config?: AutodiscoverConfig): Promise<string[]> {\n logger.debug('Autodiscovering GitHub repositories');\n const nonEmptyRepositories = (await fetchRepositories()).filter(\n isNonEmptyObject,\n );\n const nonArchivedRepositories = nonEmptyRepositories.filter(\n (repo) => !repo.archived,\n );\n if (nonArchivedRepositories.length < nonEmptyRepositories.length) {\n logger.debug(\n `Filtered out ${\n nonEmptyRepositories.length - nonArchivedRepositories.length\n } archived repositories`,\n );\n }\n if (!config?.topics) {\n return nonArchivedRepositories.map((repo) => repo.full_name);\n }\n\n logger.debug({ topics: config.topics }, 'Filtering by topics');\n const topicRepositories = nonArchivedRepositories.filter((repo) =>\n repo.topics?.some((topic) => config?.topics?.includes(topic)),\n );\n\n // v8 ignore else -- TODO: add test #40625\n if (topicRepositories.length < nonArchivedRepositories.length) {\n logger.debug(\n `Filtered out ${\n nonArchivedRepositories.length - topicRepositories.length\n } repositories not matching topic filters`,\n );\n }\n return topicRepositories.map((repo) => repo.full_name);\n}\n\nasync function getBranchProtection(\n branchName: string,\n): Promise<GithubBranchProtection> {\n if (config.parentRepo) {\n return {};\n }\n\n const res = await githubApi.getJson(\n `repos/${config.repository}/branches/${escapeHash(branchName)}/protection`,\n { cacheProvider: repoCacheProvider },\n GithubBranchProtection,\n );\n return res.body;\n}\n\nasync function getBranchRulesets(\n branchName: string,\n): Promise<GithubBranchRulesets> {\n if (config.parentRepo) {\n return [];\n }\n\n try {\n const res = await githubApi.getJson(\n `repos/${config.repository}/rules/branches/${escapeHash(branchName)}`,\n { cacheProvider: repoCacheProvider },\n GithubBranchRulesets,\n );\n return res.body;\n } catch (err) {\n if (err.statusCode === 404) {\n logger.debug(`No branch rulesets found for ${branchName}`);\n return [];\n }\n throw err;\n }\n}\n\nexport async function getRawFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n): Promise<string | null> {\n const repo = repoName ?? config.repository;\n\n // only use cache for the same org\n const httpOptions: GithubHttpOptions = {};\n const isSameOrg = repo?.split('/')?.[0] === config.repositoryOwner;\n // v8 ignore else -- TODO: add test #40625\n if (isSameOrg) {\n httpOptions.cacheProvider = repoCacheProvider;\n }\n\n let url = `repos/${repo}/contents/${fileName}`;\n if (branchOrTag) {\n url += `?ref=${branchOrTag}`;\n }\n const res = await githubApi.getJsonUnchecked<{ content: string }>(\n url,\n httpOptions,\n );\n const buf = res.body.content;\n const str = fromBase64(buf);\n return str;\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 listForks(\n token: string,\n repository: string,\n): Promise<GhRestRepo[]> {\n try {\n // Get list of existing repos\n const url = `repos/${repository}/forks?per_page=100`;\n const repos = (\n await githubApi.getJsonUnchecked<GhRestRepo[]>(url, {\n token,\n paginate: true,\n pageLimit: 100,\n })\n ).body;\n logger.debug(`Found ${repos.length} forked repo(s)`);\n return repos;\n } catch (err) {\n if (err.statusCode === 404) {\n logger.debug('Cannot list repo forks - it is likely private');\n } else {\n logger.debug({ err }, 'Unknown error listing repository forks');\n }\n throw new Error(REPOSITORY_CANNOT_FORK);\n }\n}\n\nexport async function findFork(\n token: string,\n repository: string,\n forkOrg?: string,\n): Promise<GhRestRepo | null> {\n const forks = await listForks(token, repository);\n if (forkOrg) {\n logger.debug(`Searching for forked repo in forkOrg (${forkOrg})`);\n const forkedRepo = forks.find((repo) => repo.owner.login === forkOrg);\n if (forkedRepo) {\n logger.debug(`Found repo in forkOrg: ${forkedRepo.full_name}`);\n return forkedRepo;\n }\n logger.debug(`No repo found in forkOrg`);\n }\n logger.debug(`Searching for forked repo in user account`);\n try {\n const { username } = await getUserDetails(platformConfig.endpoint, token);\n const forkedRepo = forks.find((repo) => repo.owner.login === username);\n if (forkedRepo) {\n logger.debug(`Found repo in user account: ${forkedRepo.full_name}`);\n return forkedRepo;\n }\n } catch {\n throw new Error(REPOSITORY_CANNOT_FORK);\n }\n logger.debug(`No repo found in user account`);\n return null;\n}\n\nexport async function createFork(\n token: string,\n repository: string,\n forkOrg?: string,\n): Promise<GhRestRepo> {\n let forkedRepo: GhRestRepo | undefined;\n try {\n forkedRepo = (\n await githubApi.postJson<GhRestRepo>(`repos/${repository}/forks`, {\n token,\n body: {\n organization: forkOrg ?? undefined,\n name: config.parentRepo!.replace('/', '-_-'),\n default_branch_only: true, // no baseBranchPatterns support yet\n },\n })\n ).body;\n } catch (err) {\n logger.debug({ err }, 'Error creating fork');\n }\n if (!forkedRepo) {\n throw new Error(REPOSITORY_CANNOT_FORK);\n }\n logger.info({ forkedRepo: forkedRepo.full_name }, 'Created forked repo');\n logger.debug(`Sleeping 30s after creating fork`);\n await setTimeout(30000);\n return forkedRepo;\n}\n\n// Initialize GitHub by getting base branch and SHA\nexport async function initRepo({\n repository,\n forkCreation,\n forkOrg,\n forkToken,\n gitUrl,\n renovateUsername,\n cloneSubmodules,\n cloneSubmodulesFilter,\n}: RepoParams): Promise<RepoResult> {\n logger.debug(`initRepo(\"${repository}\")`);\n // config is used by the platform api itself, not necessary for the app layer to know\n config = {\n repository,\n cloneSubmodules,\n cloneSubmodulesFilter,\n ignorePrAuthor: GlobalConfig.get('ignorePrAuthor'),\n mergeQueueEnabled: {},\n } as any;\n const opts = hostRules.find({\n hostType: 'github',\n url: platformConfig.endpoint,\n readOnly: true,\n });\n config.renovateUsername = renovateUsername;\n [config.repositoryOwner, config.repositoryName] = repository.split('/');\n let repo: GhRepo | undefined;\n let forkSshUrl: string | null = null;\n try {\n let infoQuery = repoInfoQuery;\n\n // GitHub Enterprise Server <3.3.0 doesn't support autoMergeAllowed and hasIssuesEnabled objects\n // TODO #22198\n if (\n platformConfig.isGhe &&\n // semver not null safe, accepts null and undefined\n semver.satisfies(platformConfig.gheVersion!, '<3.3.0')\n ) {\n infoQuery = infoQuery.replace(regEx(/\\n\\s*autoMergeAllowed\\s*\\n/), '\\n');\n infoQuery = infoQuery.replace(regEx(/\\n\\s*hasIssuesEnabled\\s*\\n/), '\\n');\n }\n\n // GitHub Enterprise Server <3.9.0 doesn't support hasVulnerabilityAlertsEnabled objects\n if (\n platformConfig.isGhe &&\n // semver not null safe, accepts null and undefined\n semver.satisfies(platformConfig.gheVersion!, '<3.9.0')\n ) {\n infoQuery = infoQuery.replace(\n regEx(/\\n\\s*hasVulnerabilityAlertsEnabled\\s*\\n/),\n '\\n',\n );\n }\n\n // GitHub Enterprise Server <3.12.0 doesn't support merge queues\n if (\n platformConfig.isGhe &&\n // semver not null safe, accepts null and undefined\n semver.satisfies(platformConfig.gheVersion!, '<3.12.0')\n ) {\n infoQuery = infoQuery.replace(\n regEx(/\\n\\s*mergeQueue\\s*\\{\\s*id\\s*\\}\\s*\\n/),\n '\\n',\n );\n }\n\n const res = await githubApi.requestGraphql<{\n repository: GhRepo;\n }>(infoQuery, {\n variables: {\n owner: config.repositoryOwner,\n name: config.repositoryName,\n ...(!config.ignorePrAuthor && { user: renovateUsername }),\n },\n readOnly: true,\n count: 1, // bypass graphql check\n });\n\n if (res?.errors) {\n if (res.errors.find((err) => err.type === 'RATE_LIMITED')) {\n logger.debug({ res }, 'GraphQL rate limit exceeded.');\n throw new Error(PLATFORM_RATE_LIMIT_EXCEEDED);\n }\n logger.debug({ res }, 'Unexpected GraphQL errors');\n throw new Error(PLATFORM_UNKNOWN_ERROR);\n }\n\n repo = res?.data?.repository;\n /* v8 ignore next -- defensive: GraphQL errors are handled above, a null repository is not mocked in specs */\n if (!repo) {\n logger.debug({ res }, 'No repository returned');\n throw new Error(REPOSITORY_NOT_FOUND);\n }\n /* v8 ignore next -- empty-repo detection via missing defaultBranchRef is not mocked in specs */\n if (!repo.defaultBranchRef?.name) {\n logger.debug(\n { res },\n 'No default branch returned - treating repo as empty',\n );\n throw new Error(REPOSITORY_EMPTY);\n }\n if (\n repo.nameWithOwner &&\n repo.nameWithOwner.toUpperCase() !== repository.toUpperCase()\n ) {\n logger.debug(\n { desiredRepo: repository, foundRepo: repo.nameWithOwner },\n 'Repository has been renamed',\n );\n throw new Error(REPOSITORY_RENAMED);\n }\n if (repo.isArchived) {\n logger.debug(\n 'Repository is archived - throwing error to abort renovation',\n );\n throw new Error(REPOSITORY_ARCHIVED);\n }\n // Use default branch as PR target unless later overridden.\n config.defaultBranch = repo.defaultBranchRef.name;\n // Base branch may be configured but defaultBranch is always fixed\n logger.debug(`${repository} default branch = ${config.defaultBranch}`);\n // GitHub allows administrators to block certain types of merge, so we need to check it\n if (repo.squashMergeAllowed) {\n config.mergeMethod = 'squash';\n } else if (repo.mergeCommitAllowed) {\n config.mergeMethod = 'merge';\n } else if (repo.rebaseMergeAllowed) {\n config.mergeMethod = 'rebase';\n } else {\n // This happens if we don't have Administrator read access, it is not a critical error\n logger.debug('Could not find allowed merge methods for repo');\n }\n config.autoMergeAllowed = repo.autoMergeAllowed;\n config.hasIssuesEnabled = repo.hasIssuesEnabled;\n config.hasVulnerabilityAlertsEnabled = repo.hasVulnerabilityAlertsEnabled;\n config.mergeQueueEnabled[config.defaultBranch] = isNonEmptyObject(\n repo.mergeQueue,\n );\n\n const recentIssues = Issue.array()\n .catch([])\n .parse(res?.data?.repository?.issues?.nodes);\n GithubIssueCache.addIssuesToReconcile(recentIssues);\n } catch (err) /* v8 ignore next -- initRepo error mapping needs failure shapes not mocked in specs */ {\n logger.debug({ err }, 'Caught initRepo error');\n if (\n err.message === REPOSITORY_ARCHIVED ||\n err.message === REPOSITORY_RENAMED ||\n err.message === REPOSITORY_NOT_FOUND\n ) {\n throw err;\n }\n if (err.statusCode === 403) {\n throw new Error(REPOSITORY_ACCESS_FORBIDDEN);\n }\n if (err.statusCode === 404) {\n throw new Error(REPOSITORY_NOT_FOUND);\n }\n if (err.message.startsWith('Repository access blocked')) {\n throw new Error(REPOSITORY_BLOCKED);\n }\n if (err.message === REPOSITORY_FORK_MODE_FORKED) {\n throw err;\n }\n if (err.message === REPOSITORY_FORKED) {\n throw err;\n }\n if (err.message === REPOSITORY_DISABLED) {\n throw err;\n }\n if (err.message === 'Response code 451 (Unavailable for Legal Reasons)') {\n throw new Error(REPOSITORY_ACCESS_FORBIDDEN);\n }\n logger.debug({ err }, 'Unknown GitHub initRepo error');\n throw err;\n }\n // This shouldn't be necessary, but occasional strange errors happened until it was added\n config.prList = null;\n\n if (forkToken) {\n logger.debug('Bot is in fork mode');\n if (repo.isFork) {\n logger.debug(\n `Forked repos cannot be processed when running with a forkToken, so this repo will be skipped`,\n );\n logger.debug(\n `Parent repo for this forked repo is ${repo.parent?.nameWithOwner}`,\n );\n throw new Error(REPOSITORY_FORKED);\n }\n config.forkOrg = forkOrg;\n config.forkToken = forkToken;\n // save parent name then delete\n config.parentRepo = config.repository;\n config.repository = null;\n let forkedRepo = await findFork(forkToken, repository, forkOrg);\n if (forkedRepo) {\n config.repository = forkedRepo.full_name;\n forkSshUrl = forkedRepo.ssh_url;\n const forkDefaultBranch = forkedRepo.default_branch;\n if (forkDefaultBranch !== config.defaultBranch) {\n const body = {\n ref: `refs/heads/${config.defaultBranch}`,\n sha: repo.defaultBranchRef.target.oid,\n };\n logger.debug(\n {\n defaultBranch: config.defaultBranch,\n forkDefaultBranch,\n body,\n },\n 'Fork has different default branch to parent, attempting to create branch',\n );\n try {\n await githubApi.postJson(`repos/${config.repository}/git/refs`, {\n body,\n token: forkToken,\n });\n logger.debug('Created new default branch in fork');\n } catch (err) /* v8 ignore next -- fork default-branch creation failures are not mocked in specs */ {\n if (err.response?.body?.message === 'Reference already exists') {\n logger.debug(\n `Branch ${config.defaultBranch} already exists in the fork`,\n );\n } else {\n logger.warn(\n { err, body: err.response?.body },\n 'Could not create parent defaultBranch in fork',\n );\n }\n }\n logger.debug(\n `Setting ${config.defaultBranch} as default branch for ${config.repository}`,\n );\n try {\n await githubApi.patchJson(`repos/${config.repository}`, {\n body: {\n name: config.repository.split('/')[1],\n default_branch: config.defaultBranch,\n },\n token: forkToken,\n });\n logger.debug('Successfully changed default branch for fork');\n } catch (err) /* v8 ignore next -- defensive: fork default-branch update failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Could not set default branch');\n }\n }\n } else if (forkCreation) {\n logger.debug('Forked repo is not found - attempting to create it');\n forkedRepo = await createFork(forkToken, repository, forkOrg);\n config.repository = forkedRepo.full_name;\n forkSshUrl = forkedRepo.ssh_url;\n } else {\n logger.debug('Forked repo is not found and forkCreation is disabled');\n throw new Error(REPOSITORY_FORK_MISSING);\n }\n }\n\n let authToken: string | null;\n if (forkToken) {\n logger.debug('Using forkToken for git init');\n authToken = coerceToNull(config.forkToken);\n } /* v8 ignore next -- token-type detection depends on opts.token shapes not varied in specs */ else {\n const tokenType = opts.token?.startsWith('x-access-token:')\n ? 'app'\n : 'personal access';\n logger.debug(`Using ${tokenType} token for git init`);\n authToken = opts.token ?? null;\n }\n // endpoint is validated during initPlatform\n const parsedEndpoint = parseUrl(platformConfig.endpoint)!;\n const workingSshUrl = forkToken ? forkSshUrl : repo.sshUrl;\n const url = getRepoUrl(\n config.repository!,\n gitUrl,\n workingSshUrl,\n parsedEndpoint,\n authToken,\n );\n let upstreamUrl: string | undefined;\n if (forkCreation && config.parentRepo) {\n upstreamUrl = getRepoUrl(\n config.parentRepo,\n gitUrl,\n repo.sshUrl,\n parsedEndpoint,\n authToken,\n );\n }\n await git.initRepo({\n ...config,\n url,\n upstreamUrl,\n });\n const repoConfig: RepoResult = {\n defaultBranch: config.defaultBranch,\n isFork: repo.isFork === true,\n repoFingerprint: repoFingerprint(repo.id, platformConfig.endpoint),\n };\n return repoConfig;\n}\n\nasync function checkRulesetsForForceRebase(\n branchName: string,\n): Promise<boolean> {\n try {\n const rulesets = await getBranchRulesets(branchName);\n logger.trace(\n `Ruleset: Found ${rulesets.length} rulesets for branch ${branchName}`,\n );\n\n return rulesets.some((rule) => {\n if (\n rule.type === 'required_status_checks' &&\n rule.parameters?.strict_required_status_checks_policy === true\n ) {\n logger.debug(\n `Ruleset: strict required status checks found for ${branchName}`,\n );\n return true;\n }\n\n return false;\n });\n } catch (err) {\n handleBranchProtectionError('rulesets', err, branchName);\n return false;\n }\n}\n\nasync function checkBranchProtectionForForceRebase(\n branchName: string,\n): Promise<boolean> {\n try {\n const branchProtection = await getBranchProtection(branchName);\n logger.trace(`Found branch protection for branch ${branchName}`);\n\n const strictStatusChecks = branchProtection?.required_status_checks?.strict;\n if (strictStatusChecks) {\n logger.debug(\n `Branch protection: PRs must be up-to-date before merging for ${branchName}`,\n );\n return true;\n }\n return false;\n } catch (err) {\n handleBranchProtectionError('branch-protection', err, branchName);\n return false;\n }\n}\n\nexport async function getBranchForceRebase(\n branchName: string,\n): Promise<boolean> {\n config.branchForceRebase ??= {};\n\n const cachedResult = config.branchForceRebase[branchName];\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n\n // Initialize to false before checking branch protection\n config.branchForceRebase[branchName] = false;\n\n // Check rulesets first (newer API)\n const hasRulesetForceRebase = await checkRulesetsForForceRebase(branchName);\n if (hasRulesetForceRebase) {\n config.branchForceRebase[branchName] = true;\n return true;\n }\n\n // Fall back to legacy branch protection\n const hasBranchProtectionForceRebase =\n await checkBranchProtectionForForceRebase(branchName);\n if (hasBranchProtectionForceRebase) {\n config.branchForceRebase[branchName] = true;\n }\n\n return config.branchForceRebase[branchName];\n}\n\nfunction handleBranchProtectionError(\n protection: 'branch-protection' | 'rulesets',\n err: any,\n branchName: string,\n): void {\n if (err.statusCode === 404) {\n logger.debug(`No ${protection} found for ${branchName}`);\n return;\n }\n\n const isUnauthorized =\n err.message === PLATFORM_INTEGRATION_UNAUTHORIZED || err.statusCode === 403;\n\n if (isUnauthorized) {\n logger.once.debug(\n `Branch protection: Do not have permissions to detect ${protection} for ${branchName}`,\n );\n return;\n }\n\n throw err;\n}\n\nfunction cachePr(pr?: GhPr | null): void {\n config.prList ??= [];\n // v8 ignore else -- TODO: add test #40625\n if (pr) {\n updatePrCache(pr);\n for (let idx = 0; idx < config.prList.length; idx += 1) {\n const cachedPr = config.prList[idx];\n if (cachedPr.number === pr.number) {\n config.prList[idx] = pr;\n return;\n }\n }\n config.prList.push(pr);\n }\n}\n\n// Fetch fresh Pull Request and cache it when possible\nasync function fetchPr(prNo: number): Promise<GhPr | null> {\n try {\n const { body: ghRestPr } = await githubApi.getJsonUnchecked<GhRestPr>(\n `repos/${config.parentRepo ?? config.repository}/pulls/${prNo}`,\n );\n const result = coerceRestPr(ghRestPr);\n cachePr(result);\n return result;\n } catch (err) {\n logger.warn({ err, prNo }, `GitHub fetchPr error`);\n return null;\n }\n}\n\n// Gets details for a PR\nexport async function getPr(prNo: number): Promise<GhPr | null> {\n if (!prNo) {\n return null;\n }\n const prList = await getPrList();\n let pr = prList.find(({ number }) => number === prNo) ?? null;\n if (pr) {\n logger.debug('Returning PR from cache');\n }\n pr ??= await fetchPr(prNo);\n return pr;\n}\n\nfunction matchesState(state: string, desiredState: string): boolean {\n if (desiredState === 'all') {\n return true;\n }\n if (desiredState.startsWith('!')) {\n return state !== desiredState.substring(1);\n }\n return state === desiredState;\n}\n\nexport async function getPrList(): Promise<GhPr[]> {\n if (!config.prList) {\n const repo = config.parentRepo ?? config.repository;\n\n let username = config.renovateUsername;\n if (config.forkToken || config.ignorePrAuthor) {\n username = undefined;\n }\n\n // TODO: check null `repo` (#22198)\n const prCache = await instrument('getPrCache', () =>\n getPrCache(githubApi, repo!, username),\n );\n config.prList = Object.values(prCache).sort(\n ({ number: a }, { number: b }) => b - a,\n );\n }\n\n return config.prList;\n}\n\nexport async function findPr({\n branchName,\n prTitle,\n state = 'all',\n includeOtherAuthors,\n}: FindPRConfig): Promise<GhPr | null> {\n logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`);\n\n if (includeOtherAuthors) {\n const repo = config.parentRepo ?? config.repository;\n const org = repo?.split('/')[0];\n // PR might have been created by anyone, so don't use the cached Renovate PR list\n const { body: prList } = await githubApi.getJsonUnchecked<GhRestPr[]>(\n `repos/${repo}/pulls?head=${org}:${branchName}&state=open`,\n { cacheProvider: repoCacheProvider },\n );\n\n if (!prList.length) {\n logger.debug(`No PR found for branch ${branchName}`);\n return null;\n }\n\n return coerceRestPr(prList[0]);\n }\n\n const prList = await getPrList();\n const pr = prList.find((p) => {\n if (p.sourceBranch !== branchName) {\n return false;\n }\n\n if (prTitle && prTitle.toUpperCase() !== p.title.toUpperCase()) {\n return false;\n }\n\n if (!matchesState(p.state, state)) {\n return false;\n }\n\n if (!config.forkToken && !looseEquals(config.repository, p.sourceRepo)) {\n return false;\n }\n\n return true;\n });\n if (pr) {\n logger.debug(`Found PR #${pr.number}`);\n }\n return pr ?? null;\n}\n\nasync function ensureBranchSha(\n branchName: string,\n sha: LongCommitSha,\n): Promise<void> {\n const repository = config.repository!;\n try {\n const commitUrl = `/repos/${repository}/git/commits/${sha}`;\n await githubApi.head(commitUrl, { memCache: false });\n } catch (err) {\n logger.error({ err, sha, branchName }, 'Commit not found');\n throw err;\n }\n\n const refUrl = `/repos/${config.repository}/git/refs/heads/${branchName}`;\n const branchExists = await remoteBranchExists(repository, branchName);\n\n if (branchExists) {\n try {\n await githubApi.patchJson(refUrl, { body: { sha, force: true } });\n return;\n } catch (err) {\n if (err.err?.response?.statusCode === 422) {\n logger.debug(\n { err },\n 'Branch update failed due to reference not existing - will try to create',\n );\n } else {\n logger.warn({ refUrl, err }, 'Error updating branch');\n throw err;\n }\n }\n }\n\n await githubApi.postJson(`/repos/${repository}/git/refs`, {\n body: { sha, ref: `refs/heads/${branchName}` },\n });\n}\n\n// Returns the Pull Request for a branch. Null if not exists.\nexport async function getBranchPr(branchName: string): Promise<GhPr | null> {\n logger.debug(`getBranchPr(${branchName})`);\n\n const openPr = await findPr({\n branchName,\n state: 'open',\n });\n\n if (openPr) {\n return openPr;\n }\n\n return null;\n}\n\nexport async function tryReuseAutoclosedPr(\n autoclosedPr: Pr,\n newTitle: string,\n): Promise<Pr | null> {\n const { sha, number, sourceBranch: branchName } = autoclosedPr;\n try {\n await ensureBranchSha(branchName, sha!);\n logger.debug(`Recreated autoclosed branch ${branchName} with sha ${sha}`);\n } catch (err) {\n logger.debug(\n { err, branchName, sha, autoclosedPr },\n 'Could not recreate autoclosed branch - skipping reopen',\n );\n return null;\n }\n\n try {\n const { body: ghPr } = await githubApi.patchJson<GhRestPr>(\n `repos/${config.repository}/pulls/${number}`,\n {\n body: {\n state: 'open',\n title: newTitle,\n },\n },\n );\n logger.info(\n { branchName, oldTitle: autoclosedPr.title, newTitle, number },\n 'Successfully reopened autoclosed PR',\n );\n\n const result = coerceRestPr(ghPr);\n\n const localSha = git.getBranchCommit(branchName);\n // v8 ignore else -- TODO: add test #40625\n if (localSha && localSha !== sha) {\n await git.forcePushToRemote(branchName, 'origin');\n result.sha = localSha;\n }\n\n cachePr(result);\n return result;\n } catch {\n logger.debug('Could not reopen autoclosed PR');\n return null;\n }\n}\n\nasync function getStatus(\n branchName: string,\n useCache = true,\n): Promise<CombinedBranchStatus> {\n const branch = escapeHash(branchName);\n const url = `repos/${config.repository}/commits/${branch}/status`;\n\n const { body: status } =\n await githubApi.getJsonUnchecked<CombinedBranchStatus>(url, {\n memCache: useCache,\n cacheProvider: repoCacheProvider,\n });\n\n return status;\n}\n\n// Returns the combined status for a branch.\nexport async function getBranchStatus(\n branchName: string,\n internalChecksAsSuccess: boolean,\n): Promise<BranchStatus> {\n logger.debug(`getBranchStatus(${branchName})`);\n let commitStatus: CombinedBranchStatus;\n try {\n commitStatus = await getStatus(branchName);\n } catch (err) /* v8 ignore next -- 404-to-REPOSITORY_CHANGED mapping for deleted branches is not mocked in specs */ {\n if (err.statusCode === 404) {\n logger.debug(\n 'Received 404 when checking branch status, assuming that branch has been deleted',\n );\n throw new Error(REPOSITORY_CHANGED);\n }\n logger.debug('Unknown error when checking branch status');\n throw err;\n }\n logger.debug(\n { state: commitStatus.state, statuses: commitStatus.statuses },\n 'branch status check result',\n );\n if (commitStatus.statuses && !internalChecksAsSuccess) {\n commitStatus.statuses = commitStatus.statuses.filter(\n (status) =>\n status.state !== 'success' || !status.context?.startsWith('renovate/'),\n );\n // v8 ignore else -- TODO: add test #40625\n if (!commitStatus.statuses.length) {\n logger.debug(\n 'Successful checks are all internal renovate/ checks, so returning \"pending\" branch status',\n );\n commitStatus.state = 'pending';\n }\n }\n let checkRuns: { name: string; status: string; conclusion: string }[] = [];\n // API is supported in oldest available GHE version 2.19\n try {\n const checkRunsUrl = `repos/${config.repository}/commits/${escapeHash(\n branchName,\n )}/check-runs?per_page=100`;\n const opts = {\n headers: {\n accept: 'application/vnd.github.antiope-preview+json',\n },\n paginate: true,\n paginationField: 'check_runs',\n cacheProvider: memCacheProvider,\n };\n const checkRunsRaw = (\n await githubApi.getJsonUnchecked<{\n check_runs: { name: string; status: string; conclusion: string }[];\n }>(checkRunsUrl, opts)\n ).body;\n if (checkRunsRaw.check_runs?.length) {\n checkRuns = checkRunsRaw.check_runs.map((run) => ({\n name: run.name,\n status: run.status,\n conclusion: run.conclusion,\n }));\n logger.debug({ checkRuns }, 'check runs result');\n } /* v8 ignore next -- specs always mock a non-empty check_runs response */ else {\n logger.debug({ result: checkRunsRaw }, 'No check runs found');\n }\n } catch (err) /* v8 ignore next -- check-run permission errors (403) are mapped to empty results, not mocked in specs */ {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n if (\n err.statusCode === 403 ||\n err.message === PLATFORM_INTEGRATION_UNAUTHORIZED\n ) {\n logger.debug('No permission to view check runs');\n } else {\n logger.warn({ err }, 'Error retrieving check runs');\n }\n }\n if (checkRuns.length === 0) {\n if (commitStatus.state === 'success') {\n return 'green';\n }\n if (commitStatus.state === 'failure') {\n return 'red';\n }\n return 'yellow';\n }\n if (\n commitStatus.state === 'failure' ||\n checkRuns.some((run) => run.conclusion === 'failure')\n ) {\n return 'red';\n }\n if (\n (commitStatus.state === 'success' || commitStatus.statuses.length === 0) &&\n checkRuns.every((run) =>\n ['skipped', 'neutral', 'success'].includes(run.conclusion),\n )\n ) {\n return 'green';\n }\n return 'yellow';\n}\n\nasync function getStatusCheck(\n branchName: string,\n useCache = true,\n): Promise<GhBranchStatus[]> {\n const branchCommit = git.getBranchCommit(branchName);\n\n const url = `repos/${config.repository}/commits/${branchCommit}/statuses`;\n\n const opts: GithubHttpOptions = useCache\n ? { cacheProvider: memCacheProvider }\n : { memCache: false };\n\n return (await githubApi.getJsonUnchecked<GhBranchStatus[]>(url, opts)).body;\n}\n\ntype GithubToRenovateStatusMapping = Record<string, BranchStatus>;\nconst githubToRenovateStatusMapping: GithubToRenovateStatusMapping = {\n success: 'green',\n error: 'red',\n failure: 'red',\n pending: 'yellow',\n};\n\nexport async function getBranchStatusCheck(\n branchName: string,\n context: string,\n): Promise<BranchStatus | null> {\n try {\n const res = await getStatusCheck(branchName);\n for (const check of res) {\n if (check.context === context) {\n return githubToRenovateStatusMapping[check.state] || 'yellow';\n }\n }\n return null;\n } catch (err) /* v8 ignore next -- 404-to-REPOSITORY_CHANGED mapping for missing commits is not mocked in specs */ {\n if (err.statusCode === 404) {\n logger.debug('Commit not found when checking statuses');\n throw new Error(REPOSITORY_CHANGED);\n }\n throw err;\n }\n}\n\nexport async function setBranchStatus({\n branchName,\n context,\n description,\n state,\n url: targetUrl,\n}: BranchStatusConfig): Promise<void> {\n /* v8 ignore next -- specs do not run setBranchStatus in forking mode */\n if (config.parentRepo) {\n logger.debug('Cannot set branch status when in forking mode');\n return;\n }\n const existingStatus = await getBranchStatusCheck(branchName, context);\n if (existingStatus === state) {\n return;\n }\n logger.debug({ branch: branchName, context, state }, 'Setting branch status');\n let url: string | undefined;\n try {\n const branchCommit = git.getBranchCommit(branchName);\n url = `repos/${config.repository}/statuses/${branchCommit}`;\n const renovateToGitHubStateMapping = {\n green: 'success',\n yellow: 'pending',\n red: 'failure',\n };\n const options: any = {\n state: renovateToGitHubStateMapping[state],\n description,\n context,\n };\n // v8 ignore else -- TODO: add test #40625\n if (targetUrl) {\n options.target_url = targetUrl;\n }\n await githubApi.postJson(url, { body: options });\n\n // update status cache\n await getStatus(branchName, false);\n await getStatusCheck(branchName, false);\n } catch (err) /* v8 ignore next -- defensive: status POST failures abort with REPOSITORY_CHANGED, not simulated in specs */ {\n logger.debug({ err, url }, 'Caught error setting branch status - aborting');\n throw new Error(REPOSITORY_CHANGED);\n }\n}\n\n// Issue\n\nasync function getIssues(): Promise<Issue[]> {\n const result = await githubApi.queryRepoField<unknown>(\n getIssuesQuery,\n 'issues',\n {\n variables: {\n owner: config.repositoryOwner,\n name: config.repositoryName,\n ...(!config.ignorePrAuthor && { user: config.renovateUsername }),\n },\n readOnly: true,\n },\n );\n\n logger.debug(`Retrieved ${result.length} issues`);\n return Issue.array().parse(result);\n}\n\nexport async function getIssueList(): Promise<Issue[]> {\n /* v8 ignore next -- specs initialize repos with issues enabled */\n if (config.hasIssuesEnabled === false) {\n return [];\n }\n let issueList = GithubIssueCache.getIssues();\n // v8 ignore else -- TODO: add test #40625\n if (!issueList) {\n logger.debug('Retrieving issueList');\n issueList = await getIssues();\n GithubIssueCache.setIssues(issueList);\n }\n return issueList;\n}\n\nexport async function getIssue(number: number): Promise<Issue | null> {\n if (config.hasIssuesEnabled === false) {\n return null;\n }\n try {\n const repo = config.parentRepo ?? config.repository;\n const { body: issue } = await githubApi.getJson(\n `repos/${repo}/issues/${number}`,\n {\n cacheProvider: repoCacheProvider,\n },\n Issue,\n );\n GithubIssueCache.updateIssue(issue);\n return issue;\n } catch (err) {\n logger.debug({ err, number }, 'Error getting issue');\n if (err.response?.statusCode === 410) {\n logger.debug(`Issue #${number} has been deleted`);\n GithubIssueCache.deleteIssue(number);\n }\n return null;\n }\n}\n\nexport async function findIssue(title: string): Promise<Issue | null> {\n logger.debug(`findIssue(${title})`);\n const [issue] = (await getIssueList()).filter(\n (i) => i.state === 'open' && i.title === title,\n );\n if (!issue) {\n return null;\n }\n logger.debug(`Found issue ${issue.number}`);\n return getIssue(issue.number);\n}\n\nasync function closeIssue(issueNumber: number): Promise<void> {\n logger.debug(`closeIssue(${issueNumber})`);\n const repo = config.parentRepo ?? config.repository;\n try {\n const { body: closedIssue } = await githubApi.patchJson(\n `repos/${repo}/issues/${issueNumber}`,\n { body: { state: 'closed' } },\n Issue,\n );\n GithubIssueCache.updateIssue(closedIssue);\n } catch (err) {\n const statusCode = err.response?.statusCode;\n if (statusCode === 404 || statusCode === 410) {\n logger.debug(\n `Issue #${issueNumber} no longer exists on the platform, removing from cache`,\n );\n GithubIssueCache.deleteIssue(issueNumber);\n return;\n }\n throw err;\n }\n}\n\nexport async function ensureIssue({\n title,\n reuseTitle,\n body: rawBody,\n labels,\n once = false,\n shouldReOpen = true,\n}: EnsureIssueConfig): Promise<EnsureIssueResult | null> {\n logger.debug(`ensureIssue(${title})`);\n /* v8 ignore next -- specs initialize repos with issues enabled */\n if (config.hasIssuesEnabled === false) {\n logger.info(\n 'Cannot ensure issue because issues are disabled in this repository',\n );\n return null;\n }\n const body = sanitize(rawBody);\n try {\n const issueList = await getIssueList();\n let issues = issueList.filter((i) => i.title === title);\n if (!issues.length) {\n issues = issueList.filter((i) => i.title === reuseTitle);\n if (issues.length) {\n logger.debug(`Reusing issue title: \"${reuseTitle}\"`);\n }\n }\n if (issues.length) {\n let issue = issues.find((i) => i.state === 'open');\n if (!issue) {\n if (once) {\n logger.debug('Issue already closed - skipping recreation');\n return null;\n }\n if (shouldReOpen) {\n logger.debug('Reopening previously closed issue');\n }\n issue = issues.at(-1)!;\n }\n for (const i of issues) {\n if (i.state === 'open' && i.number !== issue.number) {\n logger.warn({ issueNo: i.number }, 'Closing duplicate issue');\n await closeIssue(i.number);\n }\n }\n\n const repo = config.parentRepo ?? config.repository;\n const { body: serverIssue } = await githubApi.getJson(\n `repos/${repo}/issues/${issue.number}`,\n { cacheProvider: repoCacheProvider },\n Issue,\n );\n GithubIssueCache.updateIssue(serverIssue);\n\n if (\n issue.title === title &&\n serverIssue.body === body &&\n issue.state === 'open'\n ) {\n logger.debug('Issue is open and up to date - nothing to do');\n return null;\n }\n if (shouldReOpen || issue.state === 'open') {\n logger.debug('Patching issue');\n const data: Record<string, unknown> = { body, state: 'open', title };\n if (labels) {\n data.labels = labels;\n }\n const repo = config.parentRepo ?? config.repository;\n const { body: updatedIssue } = await githubApi.patchJson(\n `repos/${repo}/issues/${issue.number}`,\n { body: data },\n Issue,\n );\n GithubIssueCache.updateIssue(updatedIssue);\n logger.debug('Issue updated');\n return 'updated';\n }\n }\n const { body: createdIssue } = await githubApi.postJson(\n `repos/${config.parentRepo ?? config.repository}/issues`,\n {\n body: {\n title,\n body,\n labels: labels ?? [],\n },\n },\n Issue,\n );\n logger.info('Issue created');\n // reset issueList so that it will be fetched again as-needed\n GithubIssueCache.updateIssue(createdIssue);\n return 'created';\n } catch (err) /* v8 ignore next -- issue creation failure handling is not mocked in specs */ {\n if (err.body?.message?.startsWith('Issues are disabled for this repo')) {\n logger.debug(`Issues are disabled, so could not create issue: ${title}`);\n } else {\n logger.warn({ err }, 'Could not ensure issue');\n }\n }\n return null;\n}\n\nexport async function ensureIssueClosing(title: string): Promise<void> {\n logger.trace(`ensureIssueClosing(${title})`);\n /* v8 ignore next -- specs initialize repos with issues enabled */\n if (config.hasIssuesEnabled === false) {\n return;\n }\n const issueList = await getIssueList();\n for (const issue of issueList) {\n if (issue.state === 'open' && issue.title === title) {\n await closeIssue(issue.number);\n logger.debug(`Issue closed, issueNo: ${issue.number}`);\n }\n }\n}\n\nasync function tryAddMilestone(\n issueNo: number,\n milestoneNo: number | undefined,\n): Promise<void> {\n if (!milestoneNo) {\n return;\n }\n\n logger.debug(\n {\n milestone: milestoneNo,\n pr: issueNo,\n },\n 'Adding milestone to PR',\n );\n try {\n const repo = config.parentRepo ?? config.repository;\n const { body: updatedIssue } = await githubApi.patchJson(\n `repos/${repo}/issues/${issueNo}`,\n { body: { milestone: milestoneNo } },\n Issue,\n );\n GithubIssueCache.updateIssue(updatedIssue);\n } catch (err) {\n /* v8 ignore next -- defensive: the raw-error fallback is for non-HTTP failures not seen in specs */\n const actualError = err.response?.body ?? err;\n logger.warn(\n {\n milestone: milestoneNo,\n pr: issueNo,\n err: actualError,\n },\n 'Unable to add milestone to PR',\n );\n }\n}\n\nexport async function addAssignees(\n issueNo: number,\n assignees: string[],\n): Promise<void> {\n logger.debug(`Adding assignees '${assignees.join(', ')}' to #${issueNo}`);\n const repository = config.parentRepo ?? config.repository;\n const url = `repos/${repository}/issues/${issueNo}/assignees`;\n let lastErr: Error | undefined;\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n const { body: updatedIssue } = await githubApi.postJson(\n url,\n { body: { assignees } },\n Issue,\n );\n GithubIssueCache.updateIssue(updatedIssue);\n return;\n } catch (err) {\n if (err.statusCode !== 404) {\n throw err;\n }\n lastErr = err;\n logger.debug(\n { attempt: attempt + 1 },\n `Retrying addAssignees for #${issueNo} after 404`,\n );\n await setTimeout(1000);\n }\n }\n throw lastErr!;\n}\n\nexport async function addReviewers(\n prNo: number,\n reviewers: string[],\n): Promise<void> {\n logger.debug(`Adding reviewers '${reviewers.join(', ')}' to #${prNo}`);\n\n const userReviewers = reviewers.filter((e) => !e.startsWith('team:'));\n const teamReviewers = reviewers\n .filter((e) => e.startsWith('team:'))\n .map((e) => e.replace(regEx(/^team:/), ''));\n try {\n await githubApi.postJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/pulls/${prNo}/requested_reviewers`,\n {\n body: {\n reviewers: userReviewers,\n team_reviewers: teamReviewers,\n },\n },\n );\n } catch (err) /* v8 ignore next -- defensive: reviewer assignment failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Failed to assign reviewer');\n }\n}\n\nexport async function addLabels(\n issueNo: number,\n labels: string[] | null | undefined,\n): Promise<void> {\n logger.debug(`Adding labels '${labels?.join(', ')}' to #${issueNo}`);\n try {\n const repository = config.parentRepo ?? config.repository;\n if (isArray(labels) && labels.length) {\n await githubApi.postJson(`repos/${repository}/issues/${issueNo}/labels`, {\n body: labels,\n });\n }\n } catch (err) /* v8 ignore next -- defensive: label-adding failures are logged and swallowed, not simulated in specs */ {\n logger.warn(\n { err, issueNo, labels },\n 'Error while adding labels. Skipping',\n );\n }\n}\n\nexport async function deleteLabel(\n issueNo: number,\n label: string,\n): Promise<void> {\n logger.debug(`Deleting label ${label} from #${issueNo}`);\n const repository = config.parentRepo ?? config.repository;\n try {\n await githubApi.deleteJson(\n `repos/${repository}/issues/${issueNo}/labels/${label}`,\n );\n } catch (err) /* v8 ignore next -- defensive: label deletion failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err, issueNo, label }, 'Failed to delete label');\n }\n}\n\nasync function addComment(issueNo: number, body: string): Promise<void> {\n // POST /repos/:owner/:repo/issues/:number/comments\n await githubApi.postJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/issues/${issueNo}/comments`,\n {\n body: { body },\n },\n );\n}\n\nasync function editComment(commentId: number, body: string): Promise<void> {\n // PATCH /repos/:owner/:repo/issues/comments/:id\n await githubApi.patchJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/issues/comments/${commentId}`,\n {\n body: { body },\n },\n );\n}\n\nasync function deleteComment(commentId: number): Promise<void> {\n // DELETE /repos/:owner/:repo/issues/comments/:id\n await githubApi.deleteJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/issues/comments/${commentId}`,\n );\n}\n\nasync function getComments(issueNo: number): Promise<Comment[]> {\n // GET /repos/:owner/:repo/issues/:number/comments\n logger.debug(`Getting comments for #${issueNo}`);\n const repo = config.parentRepo ?? config.repository;\n const url = `repos/${repo}/issues/${issueNo}/comments?per_page=100`;\n try {\n const { body: comments } = await githubApi.getJsonUnchecked<Comment[]>(\n url,\n {\n paginate: true,\n cacheProvider: repoCacheProvider,\n },\n );\n logger.debug(`Found ${comments.length} comments`);\n return comments;\n } catch (err) /* v8 ignore next -- comment-fetch 404s are wrapped as ExternalHostError, not mocked in specs */ {\n if (err.statusCode === 404) {\n logger.debug('404 response when retrieving comments');\n throw new ExternalHostError(err, 'github');\n }\n throw err;\n }\n}\n\nexport async function ensureComment({\n number,\n topic,\n content,\n}: EnsureCommentConfig): Promise<boolean> {\n const sanitizedContent = sanitize(content);\n try {\n const comments = await getComments(number);\n let body: string;\n let commentId: number | null = null;\n let commentNeedsUpdating = false;\n if (topic) {\n logger.debug(`Ensuring comment \"${topic}\" in #${number}`);\n body = `### ${topic}\\n\\n${sanitizedContent}`;\n comments.forEach((comment) => {\n if (comment.body.startsWith(`### ${topic}\\n\\n`)) {\n commentId = comment.id;\n commentNeedsUpdating = comment.body !== body;\n }\n });\n } else {\n logger.debug(`Ensuring content-only comment in #${number}`);\n body = `${sanitizedContent}`;\n comments.forEach((comment) => {\n // v8 ignore else -- TODO: add test #40625\n if (comment.body === body) {\n commentId = comment.id;\n commentNeedsUpdating = false;\n }\n });\n }\n if (!commentId) {\n await addComment(number, body);\n logger.info(\n { repository: config.repository, issueNo: number, topic },\n 'Comment added',\n );\n } else if (commentNeedsUpdating) {\n await editComment(commentId, body);\n logger.debug(\n { repository: config.repository, issueNo: number },\n 'Comment updated',\n );\n } else {\n logger.debug('Comment is already up-to-date');\n }\n return true;\n } catch (err) /* v8 ignore next -- comment API failure handling (locked issues) is not mocked in specs */ {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n if (err.body?.message?.includes('is locked')) {\n logger.debug('Issue is locked - cannot add comment');\n } else {\n logger.warn({ err }, 'Error ensuring comment');\n }\n return false;\n }\n}\n\nfunction byTopic(comment: Comment, topic: string): boolean {\n return comment.body.startsWith(`### ${topic}\\n\\n`);\n}\n\nfunction byContent(comment: Comment, content: string): boolean {\n return comment.body.trim() === content;\n}\n\nexport async function ensureCommentRemoval(\n deleteConfig: EnsureCommentRemovalConfig,\n): Promise<void> {\n const { number: issueNo } = deleteConfig;\n const key =\n deleteConfig.type === 'by-topic'\n ? deleteConfig.topic\n : deleteConfig.content;\n logger.trace(`Ensuring comment \"${key}\" in #${issueNo} is removed`);\n const comments = await getComments(issueNo);\n let commentId: number | null | undefined = null;\n\n // v8 ignore else -- TODO: add test #40625\n if (deleteConfig.type === 'by-topic') {\n const topic = deleteConfig.topic;\n commentId = comments.find((comment) => byTopic(comment, topic))?.id;\n } else if (deleteConfig.type === 'by-content') {\n const content = deleteConfig.content;\n commentId = comments.find((comment) => byContent(comment, content))?.id;\n }\n\n try {\n // v8 ignore else -- TODO: add test #40625\n if (commentId) {\n logger.debug(`Removing comment from issueNo: ${issueNo}`);\n await deleteComment(commentId);\n }\n } catch (err) /* v8 ignore next -- defensive: comment deletion failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Error deleting comment');\n }\n}\n\n// Pull Request\n\nasync function tryPrAutomerge(\n prNumber: number,\n prNodeId: string,\n platformPrOptions: PlatformPrOptions | undefined,\n): Promise<void> {\n if (!platformPrOptions?.usePlatformAutomerge) {\n return;\n }\n\n // If GitHub Enterprise Server <3.3.0 it doesn't support automerge\n // TODO #22198\n // semver not null safe, accepts null and undefined\n if (\n platformConfig.isGhe &&\n semver.satisfies(platformConfig.gheVersion!, '<3.3.0')\n ) {\n logger.debug(\n { prNumber },\n 'GitHub-native automerge: not supported on this version of GHE. Use 3.3.0 or newer.',\n );\n return;\n }\n\n if (!config.autoMergeAllowed) {\n logger.debug(\n { prNumber },\n 'GitHub-native automerge: not enabled in repo settings',\n );\n return;\n }\n\n try {\n const mergeMethod = config.mergeMethod?.toUpperCase() || 'MERGE';\n\n let commitHeadline: string | undefined;\n let commitBody: string | undefined;\n // For SQUASH and MERGE methods, pass the commit message explicitly to avoid\n // GitHub using the PR description as the commit body when \"Use PR title and\n // body as commit message\" is enabled in repository settings.\n const automergeCommitMessage = platformPrOptions?.automergeCommitMessage;\n if (mergeMethod !== 'REBASE' && automergeCommitMessage) {\n const newlineIndex = automergeCommitMessage.indexOf('\\n');\n if (newlineIndex === -1) {\n commitHeadline = automergeCommitMessage;\n } else {\n commitHeadline = automergeCommitMessage.slice(0, newlineIndex);\n commitBody = automergeCommitMessage.slice(newlineIndex + 1).trim();\n }\n\n // Add PR number to the commit headline to match the default GitHub behavior\n commitHeadline = `${commitHeadline} (#${prNumber})`;\n }\n\n const variables = {\n pullRequestId: prNodeId,\n mergeMethod,\n commitHeadline,\n commitBody,\n };\n // set count to one bypass graphql check\n const queryOptions = { variables, count: 1 };\n\n const res = await githubApi.requestGraphql<GhAutomergeResponse>(\n enableAutoMergeMutation,\n queryOptions,\n );\n\n if (res?.errors) {\n logger.debug(\n { prNumber, errors: res.errors },\n 'GitHub-native automerge: fail',\n );\n return;\n }\n\n logger.debug(`GitHub-native automerge: success...PrNo: ${prNumber}`);\n } catch (err) /* v8 ignore next: missing test #22198 */ {\n logger.warn({ prNumber, err }, 'GitHub-native automerge: REST API error');\n }\n}\n\n// Creates PR and returns PR number\nexport async function createPr({\n sourceBranch,\n targetBranch,\n prTitle: title,\n prBody: rawBody,\n labels,\n draftPR = false,\n platformPrOptions,\n milestone,\n}: CreatePRConfig): Promise<GhPr | null> {\n const body = sanitize(rawBody);\n const base = targetBranch;\n // Include the repository owner to handle forkToken and regular mode\n // TODO: can `repository` be null? (#22198)\n\n const head = `${config.repository!.split('/')[0]}:${sourceBranch}`;\n const options: any = {\n body: {\n title,\n head,\n base,\n body,\n draft: draftPR,\n },\n };\n /* v8 ignore next -- fork mode is not exercised in createPr specs */\n if (config.forkToken) {\n options.token = config.forkToken;\n options.body.maintainer_can_modify =\n !config.forkOrg &&\n platformPrOptions?.forkModeDisallowMaintainerEdits !== true;\n }\n logger.debug({ title, head, base, draft: draftPR }, 'Creating PR');\n const ghPr = (\n await githubApi.postJson<GhRestPr>(\n `repos/${config.parentRepo ?? config.repository}/pulls`,\n options,\n )\n ).body;\n logger.debug(\n { branch: sourceBranch, pr: ghPr.number, draft: draftPR },\n 'PR created',\n );\n\n const result = coerceRestPr(ghPr);\n const { number, node_id } = result;\n\n await addLabels(number, labels);\n await tryAddMilestone(number, milestone);\n await tryPrAutomerge(number, node_id, platformPrOptions);\n\n cachePr(result);\n return result;\n}\n\nasync function isMergeQueueEnabled(baseBranch: string): Promise<boolean> {\n const cachedResult = config.mergeQueueEnabled[baseBranch];\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n\n // TODO #22198\n // semver not null safe, accepts null and undefined\n if (\n platformConfig.isGhe &&\n semver.satisfies(platformConfig.gheVersion!, '<3.12.0')\n ) {\n // Merge queues are only supported on GHES >=3.12.0\n config.mergeQueueEnabled[baseBranch] = false;\n return false;\n }\n\n // Assume enabled unless proven otherwise, so the merge queue check is not\n // skipped by mistake\n let result = true;\n try {\n const res = await githubApi.requestGraphql<{\n repository: { mergeQueue: { id: string } | null };\n }>(repoMergeQueueQuery, {\n variables: {\n owner: config.repositoryOwner,\n name: config.repositoryName,\n branch: baseBranch,\n },\n readOnly: true,\n count: 1, // bypass graphql check\n });\n if (res?.errors) {\n logger.debug(\n { baseBranch, errors: res.errors },\n 'Failed to fetch merge queue status - assuming merge queue is enabled',\n );\n } else {\n result = isNonEmptyObject(res?.data?.repository?.mergeQueue);\n }\n } catch (err) {\n logger.debug(\n { baseBranch, err },\n 'Error fetching merge queue status - assuming merge queue is enabled',\n );\n }\n\n config.mergeQueueEnabled[baseBranch] = result;\n return result;\n}\n\nexport async function assertPrNotInMergeQueue(\n branchName: string,\n baseBranch?: string,\n): Promise<void> {\n if (!(await isMergeQueueEnabled(baseBranch ?? config.defaultBranch))) {\n return;\n }\n\n const pr = await findPr({ branchName, state: 'open' });\n if (!pr) {\n return;\n }\n\n if (\n await isPrInMergeQueue(\n githubApi,\n config.repositoryOwner,\n config.repositoryName,\n pr.number,\n )\n ) {\n logger.debug(`PR #${pr.number} is in the merge queue - aborting push`);\n throw new Error(PR_ALREADY_IN_MERGE_QUEUE);\n }\n}\n\nexport async function updatePr({\n number: prNo,\n prTitle: title,\n prBody: rawBody,\n addLabels: labelsToAdd,\n removeLabels,\n state,\n targetBranch,\n}: UpdatePrConfig): Promise<void> {\n logger.debug(`updatePr(${prNo}, ${title}, body)`);\n const body = sanitize(rawBody);\n const patchBody: any = { title };\n // v8 ignore else -- TODO: add test #40625\n if (body) {\n patchBody.body = body;\n }\n if (targetBranch) {\n patchBody.base = targetBranch;\n }\n if (state) {\n patchBody.state = state;\n }\n const options: any = {\n body: patchBody,\n };\n /* v8 ignore next -- fork mode is not exercised in updatePr specs */\n if (config.forkToken) {\n options.token = config.forkToken;\n }\n\n // Update PR labels\n try {\n if (labelsToAdd) {\n await addLabels(prNo, labelsToAdd);\n }\n\n if (removeLabels) {\n for (const label of removeLabels) {\n await deleteLabel(prNo, label);\n }\n }\n\n const { body: ghPr } = await githubApi.patchJson<GhRestPr>(\n `repos/${config.parentRepo ?? config.repository}/pulls/${prNo}`,\n options,\n );\n const result = coerceRestPr(ghPr);\n cachePr(result);\n logger.debug(`PR updated...prNo: ${prNo}`);\n } catch (err) /* v8 ignore next -- non-host update failures are logged and swallowed, not mocked in specs */ {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n logger.warn({ err }, 'Error updating PR');\n }\n}\n\nexport async function reattemptPlatformAutomerge({\n number,\n platformPrOptions,\n}: ReattemptPlatformAutomergeConfig): Promise<void> {\n try {\n const result = (await getPr(number))!;\n const { node_id } = result;\n\n await tryPrAutomerge(number, node_id, platformPrOptions);\n\n logger.debug(`PR platform automerge re-attempted...prNo: ${number}`);\n } catch (err) /* v8 ignore next -- defensive: automerge re-attempt failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Error re-attempting PR platform automerge');\n }\n}\n\nexport async function mergePr({\n branchName,\n id: prNo,\n strategy,\n}: MergePRConfig): Promise<boolean> {\n logger.debug(`mergePr(${prNo}, ${branchName})`);\n const url = `repos/${\n config.parentRepo ?? config.repository\n }/pulls/${prNo}/merge`;\n const options: GithubHttpOptions = {\n body: {},\n };\n /* v8 ignore next -- fork mode is not exercised in mergePr specs */\n if (config.forkToken) {\n options.token = config.forkToken;\n }\n let automerged = false;\n let automergeResult: HttpResponse<unknown>;\n const mergeStrategy = mapMergeStartegy(strategy) ?? config.mergeMethod;\n\n // v8 ignore else -- TODO: add test #40625\n if (mergeStrategy) {\n // This path is taken if we have auto-detected the allowed merge types from the repo or\n // automergeStrategy is configured by user\n options.body.merge_method = mergeStrategy;\n try {\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n automerged = true;\n } catch (err) /* v8 ignore next -- merge rejection handling (404/405 status-check bodies) is not fully mocked in specs */ {\n if (err.statusCode === 404 || err.statusCode === 405) {\n const body = err.response?.body;\n if (\n isNonEmptyString(body?.message) &&\n regEx(/^Required status check \".+\" is expected\\.$/).test(body.message)\n ) {\n logger.debug(\n { response: body },\n `GitHub blocking PR merge -- Missing required status check(s)`,\n );\n return false;\n }\n if (\n isNonEmptyString(body?.message) &&\n (body.message.includes('approving review') ||\n body.message.includes('code owner review'))\n ) {\n logger.debug(\n { response: body },\n `GitHub blocking PR merge -- Needs approving review(s)`,\n );\n return false;\n }\n logger.debug(\n { response: body },\n 'GitHub blocking PR merge -- will keep trying',\n );\n } else {\n logger.warn(\n { mergeMethod: config.mergeMethod, err },\n 'Failed to merge PR',\n );\n return false;\n }\n }\n }\n if (!automerged) {\n // We need to guess the merge method and try squash -> merge -> rebase\n options.body.merge_method = 'squash';\n try {\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n } catch (err1) {\n logger.debug({ err: err1 }, `Failed to squash merge PR`);\n try {\n options.body.merge_method = 'merge';\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n } catch (err2) {\n logger.debug({ err: err2 }, `Failed to merge commit PR`);\n try {\n options.body.merge_method = 'rebase';\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n } catch (err3) {\n logger.debug({ err: err3 }, `Failed to rebase merge PR`);\n logger.info({ pr: prNo }, 'All merge attempts failed');\n return false;\n }\n }\n }\n }\n logger.debug(\n { automergeResult: automergeResult!.body, pr: prNo },\n 'PR merged',\n );\n const cachedPr = config.prList?.find(({ number }) => number === prNo);\n if (cachedPr) {\n cachePr({ ...cachedPr, state: 'merged' });\n }\n return true;\n}\n\nexport function massageMarkdown(input: string): string {\n if (platformConfig.isGhe) {\n return smartTruncate(input, maxBodyLength());\n }\n const massagedInput = massageMarkdownLinks(input)\n // to be safe, replace all github.com links with redirect.github.com\n .replace(\n regEx(/href=\"https?:\\/\\/github.com\\//g),\n 'href=\"https://redirect.github.com/',\n )\n .replace(\n regEx(/]\\(https:\\/\\/github\\.com\\//g),\n '](https://redirect.github.com/',\n )\n .replace(\n regEx(/]: https:\\/\\/github\\.com\\//g),\n ']: https://redirect.github.com/',\n )\n .replaceAll('> ℹ **Note**\\n> \\n', '> [!NOTE]\\n')\n .replaceAll('> ℹ️ **Note**\\n> \\n', '> [!NOTE]\\n')\n .replaceAll('> ⚠ **Warning**\\n> \\n', '> [!WARNING]\\n')\n .replaceAll('> ⚠️ **Warning**\\n> \\n', '> [!WARNING]\\n')\n .replaceAll('> ❗ **Caution**\\n> \\n', '> [!CAUTION]\\n')\n .replaceAll('> ❗ **Important**\\n> \\n', '> [!IMPORTANT]\\n');\n return smartTruncate(massagedInput, maxBodyLength());\n}\n\nexport function maxBodyLength(): number {\n return GitHubMaxPrBodyLen;\n}\n\nexport async function getVulnerabilityAlerts(): Promise<GithubVulnerabilityAlerts> {\n /* v8 ignore next -- specs initialize repos with vulnerability alerts enabled */\n if (config.hasVulnerabilityAlertsEnabled === false) {\n logger.debug('No vulnerability alerts enabled for repo');\n return [];\n }\n let vulnerabilityAlerts: GithubVulnerabilityAlerts | undefined;\n try {\n vulnerabilityAlerts = (\n await githubApi.getJson(\n `/repos/${config.repositoryOwner}/${config.repositoryName}/dependabot/alerts?state=open&direction=asc&per_page=100`,\n {\n paginate: true,\n headers: { accept: 'application/vnd.github+json' },\n cacheProvider: repoCacheProvider,\n },\n GithubVulnerabilityAlerts,\n )\n ).body;\n } catch (err) /* v8 ignore next -- alert-permission failures are logged and swallowed, not mocked in specs */ {\n logger.debug({ err }, 'Error retrieving vulnerability alerts');\n logger.warn(\n {\n url: `${GlobalConfig.get('productLinks').documentation}configuration-options/#vulnerabilityalerts`,\n },\n 'Cannot access vulnerability alerts. Please ensure permissions have been granted.',\n );\n }\n try {\n if (vulnerabilityAlerts?.length) {\n const shortAlerts: AggregatedVulnerabilities = {};\n logger.trace(\n { alerts: vulnerabilityAlerts },\n 'GitHub vulnerability details',\n );\n for (const alert of vulnerabilityAlerts) {\n // v8 ignore if -- TODO: can never happen but makes typescript happy #40625\n if (alert.security_vulnerability === null) {\n // As described in the documentation, there are cases in which\n // GitHub API responds with `\"securityVulnerability\": null`.\n // But it's may be faulty, so skip processing it here.\n continue;\n }\n const {\n package: { name, ecosystem },\n vulnerable_version_range: vulnerableVersionRange,\n first_patched_version: firstPatchedVersion,\n } = alert.security_vulnerability;\n const patch = firstPatchedVersion?.identifier;\n\n const normalizedName =\n ecosystem === 'pip' ? normalizePythonDepName(name) : name;\n alert.security_vulnerability.package.name = normalizedName;\n const key = `${ecosystem.toLowerCase()}/${normalizedName}`;\n const range = vulnerableVersionRange;\n const elem = shortAlerts[key] || {};\n elem[range] = coerceToNull(patch);\n shortAlerts[key] = elem;\n }\n logger.debug({ alerts: shortAlerts }, 'GitHub vulnerability details');\n } else {\n logger.debug('No vulnerability alerts found');\n }\n } catch (err) /* v8 ignore next -- defensive: processing already-parsed alerts does not throw in specs */ {\n logger.error({ err }, 'Error processing vulnerabity alerts');\n }\n return vulnerabilityAlerts ?? [];\n}\n\nasync function pushFiles(\n { branchName, message, trailers }: CommitFilesConfig,\n { parentCommitSha, commitSha }: CommitResult,\n): Promise<LongCommitSha | null> {\n try {\n // Hybrid git/REST commit strategy (see #13824, #14271):\n // 1. The git push below uploads blobs to GitHub via a custom ref\n // (refs/renovate/branches/*) which does NOT trigger CI/Actions.\n // 2. We then recreate the tree+commit via REST API so that:\n // - The commit is signed by GitHub (\"committed via GitHub\" badge)\n // - Force-push and file mode bits are supported (GraphQL can't do this)\n // - We can use base_tree to send only changed files, avoiding org\n // ruleset file-path restrictions on unchanged files (#42554)\n // Reusing the pushed commit/tree SHAs directly does not work because\n // the branch ref must point to an API-created commit for signing.\n await pushCommitToRenovateRef(commitSha, branchName);\n const baseTreeSha = await getCommitTreeSha(parentCommitSha);\n const treeItems = await diffCommitTree(parentCommitSha, commitSha);\n\n if (treeItems.length === 0) {\n logger.debug(\n { branchName },\n 'Platform-native commit: no changed files between commits',\n );\n return null;\n }\n\n const treeRes = await githubApi.postJson<{ sha: string }>(\n `/repos/${config.repository}/git/trees`,\n { body: { base_tree: baseTreeSha, tree: treeItems } },\n );\n const treeSha = treeRes.body.sha;\n\n const commitMessage = formatCommitMessage(message, trailers);\n\n // Now we recreate the commit using the tree we recreated the step before\n const commitRes = await githubApi.postJson<{ sha: string }>(\n `/repos/${config.repository}/git/commits`,\n {\n body: {\n message: commitMessage,\n tree: treeSha,\n parents: [parentCommitSha],\n },\n },\n );\n incLimitedValue('Commits');\n const remoteCommitSha = toLongCommitSha(commitRes.body.sha);\n await ensureBranchSha(branchName, remoteCommitSha);\n return remoteCommitSha;\n } catch (err) {\n logger.debug({ branchName, err }, 'Platform-native commit: unknown error');\n return null;\n }\n}\n\nexport async function commitFiles(\n config: CommitFilesConfig,\n): Promise<LongCommitSha | null> {\n const commitResult = await git.prepareCommit(config); // Commit locally and don't push\n const { branchName, files } = config;\n if (!commitResult) {\n logger.debug(\n { branchName, files: files.map(({ path }) => path) },\n `Platform-native commit: unable to prepare for commit`,\n );\n return null;\n }\n // Perform the commits using REST API\n const pushResult = await pushFiles(config, commitResult);\n if (!pushResult) {\n return null;\n }\n // Replace locally created branch with the remotely created one\n // and return the remote commit SHA\n await git.resetToCommit(commitResult.parentCommitSha);\n const commitSha = await git.fetchBranch(branchName);\n return commitSha;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,MAAa,KAAK;AAElB,IAAI;AACJ,IAAI;AAGJ,MAAM,qBAAqB;AAE3B,SAAgB,eAAqB;CACnC,SAAS,CAAC;CACV,iBAAiB;EACf,UAAU;EACV,UAAU;CACZ;AACF;AAEA,aAAa;AAEb,SAAS,WAAW,OAAuB;CACzC,OAAO,OAAO,QAAQ,MAAM,IAAI,GAAG,KAAK;AAC1C;AAEA,SAAgB,UAAmB;CACjC,OAAO,CAAC,CAAC,eAAe;AAC1B;AAEA,eAAsB,UAAU,OAA8B;CAC5D,MAAM,iB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AAc;EACjB,OAAO,MACL;GAAE;GAAY,OAAO,MAAM,KAAK,EAAE,WAAW,IAAI;EAAE,GACnD,sDACF;EACA,OAAO;CACT;CAGA,IAAI,CAAC,MADoB,UAAU,QAAQ,YAAY,GAErD,OAAO;CAIT,MAAMC,cAAkB,aAAa,eAAe;CAEpD,OAAO,MADiBC,YAAgB,UAAU;AAEpD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["hostRules.find","Issue","git.initRepo","git.getBranchCommit","git.forcePushToRemote","git.prepareCommit","git.resetToCommit","git.fetchBranch"],"sources":["../../../../lib/modules/platform/github/index.ts"],"sourcesContent":["import { setTimeout } from 'node:timers/promises';\nimport { isArray, isNonEmptyObject, isNonEmptyString } from '@sindresorhus/is';\nimport semver from 'semver';\nimport { GlobalConfig } from '../../../config/global.ts';\nimport {\n PLATFORM_INTEGRATION_UNAUTHORIZED,\n PLATFORM_RATE_LIMIT_EXCEEDED,\n PLATFORM_UNKNOWN_ERROR,\n PR_ALREADY_IN_MERGE_QUEUE,\n REPOSITORY_ACCESS_FORBIDDEN,\n REPOSITORY_ARCHIVED,\n REPOSITORY_BLOCKED,\n REPOSITORY_CANNOT_FORK,\n REPOSITORY_CHANGED,\n REPOSITORY_DISABLED,\n REPOSITORY_EMPTY,\n REPOSITORY_FORKED,\n REPOSITORY_FORK_MISSING,\n REPOSITORY_FORK_MODE_FORKED,\n REPOSITORY_NOT_FOUND,\n REPOSITORY_RENAMED,\n} from '../../../constants/error-messages.ts';\nimport { instrument } from '../../../instrumentation/index.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport type { BranchStatus } from '../../../types/index.ts';\nimport { isGithubFineGrainedPersonalAccessToken } from '../../../util/check-token.ts';\nimport { coerceToNull } from '../../../util/coerce.ts';\nimport { parseJson } from '../../../util/common.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { formatCommitMessage } from '../../../util/git/commit-trailers.ts';\nimport * as git from '../../../util/git/index.ts';\nimport {\n diffCommitTree,\n getCommitTreeSha,\n pushCommitToRenovateRef,\n} from '../../../util/git/index.ts';\nimport type {\n CommitFilesConfig,\n CommitResult,\n} from '../../../util/git/types.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { memCacheProvider } from '../../../util/http/cache/memory-http-cache-provider.ts';\nimport { repoCacheProvider } from '../../../util/http/cache/repository-http-cache-provider.ts';\nimport type { GithubHttpOptions } from '../../../util/http/github.ts';\nimport * as githubHttp from '../../../util/http/github.ts';\nimport type { HttpResponse } from '../../../util/http/types.ts';\nimport { coerceObject } from '../../../util/object.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { sanitize } from '../../../util/sanitize.ts';\nimport type { LongCommitSha } from '../../../util/schema-utils/git.ts';\nimport { toLongCommitSha } from '../../../util/schema-utils/git.ts';\nimport { fromBase64, looseEquals } from '../../../util/string.ts';\nimport { ensureTrailingSlash, isHttpUrl, parseUrl } from '../../../util/url.ts';\nimport { incLimitedValue } from '../../../workers/global/limits.ts';\nimport { normalizePythonDepName } from '../../datasource/pypi/common.ts';\nimport type {\n AutodiscoverConfig,\n BranchStatusConfig,\n CreatePRConfig,\n EnsureCommentConfig,\n EnsureCommentRemovalConfig,\n EnsureIssueConfig,\n EnsureIssueResult,\n FindPRConfig,\n MergePRConfig,\n PlatformParams,\n PlatformPrOptions,\n PlatformResult,\n Pr,\n ReattemptPlatformAutomergeConfig,\n RepoParams,\n RepoResult,\n UpdatePrConfig,\n} from '../types.ts';\nimport { repoFingerprint } from '../util.ts';\nimport { smartTruncate } from '../utils/pr-body.ts';\nimport { remoteBranchExists } from './branch.ts';\nimport { coerceRestPr, githubApi, mapMergeStartegy } from './common.ts';\nimport {\n enableAutoMergeMutation,\n getIssuesQuery,\n repoInfoQuery,\n repoMergeQueueQuery,\n} from './graphql.ts';\nimport { GithubIssueCache } from './issue.ts';\nimport { massageMarkdownLinks } from './massage-markdown-links.ts';\nimport { getPrCache, isPrInMergeQueue, updatePrCache } from './pr.ts';\nimport {\n GithubBranchProtection,\n GithubBranchRulesets,\n GithubVulnerabilityAlerts,\n GithubIssue as Issue,\n} from './schema.ts';\nimport type {\n AggregatedVulnerabilities,\n CombinedBranchStatus,\n Comment,\n GhAutomergeResponse,\n GhBranchStatus,\n GhPr,\n GhRepo,\n GhRestPr,\n GhRestRepo,\n LocalRepoConfig,\n PlatformConfig,\n} from './types.ts';\nimport { getAppDetails, getUserDetails, getUserEmail } from './user.ts';\nimport { getRepoUrl, warnIfDefaultGitAuthorEmail } from './utils.ts';\n\nexport const id = 'github';\n\nlet config: LocalRepoConfig;\nlet platformConfig: PlatformConfig;\n\n// GitHub's max is 60k but in the hosted app we've observed that content-length is ~1k longer\nconst GitHubMaxPrBodyLen = 58000;\n\nexport function resetConfigs(): void {\n config = {} as never;\n platformConfig = {\n hostType: 'github',\n endpoint: 'https://api.github.com/',\n };\n}\n\nresetConfigs();\n\nfunction escapeHash(input: string): string {\n return input?.replace(regEx(/#/g), '%23');\n}\n\nexport function isGHApp(): boolean {\n return !!platformConfig.isGHApp;\n}\n\nexport async function detectGhe(token: string): Promise<void> {\n const parsedEndpoint = parseUrl(platformConfig.endpoint);\n /* v8 ignore next -- endpoint is validated in initPlatform before detectGhe is called */\n if (!parsedEndpoint) {\n throw new Error(`Invalid GitHub endpoint: ${platformConfig.endpoint}`);\n }\n const host = parsedEndpoint.host;\n platformConfig.isGhe = host !== 'api.github.com';\n platformConfig.isGheCloud = host.endsWith('.ghe.com');\n if (platformConfig.isGhe) {\n const gheHeaderKey = 'x-github-enterprise-version';\n const gheQueryRes = await githubApi.headJson('/', { token });\n const gheHeaders = coerceObject(gheQueryRes?.headers);\n const [, gheVersion] =\n Object.entries(gheHeaders).find(\n ([k]) => k.toLowerCase() === gheHeaderKey,\n ) ?? [];\n platformConfig.gheVersion = semver.valid(gheVersion as string) ?? null;\n logger.debug(\n `Detected GitHub Enterprise Server, version: ${platformConfig.gheVersion}`,\n );\n }\n}\n\nexport async function initPlatform({\n endpoint,\n token: originalToken,\n username,\n gitAuthor,\n}: PlatformParams): Promise<PlatformResult> {\n let token = originalToken;\n if (!token) {\n throw new Error('Init: You must configure a GitHub token');\n }\n token = token.replace(regEx(/^ghs_/), 'x-access-token:ghs_');\n platformConfig.isGHApp = token.startsWith('x-access-token:');\n\n if (endpoint) {\n if (!isHttpUrl(endpoint)) {\n throw new Error(`Init: Invalid GitHub endpoint URL: ${endpoint}`);\n }\n platformConfig.endpoint = ensureTrailingSlash(endpoint);\n githubHttp.setBaseUrl(platformConfig.endpoint);\n } else {\n logger.debug(`Using default github endpoint: ${platformConfig.endpoint}`);\n }\n\n await detectGhe(token);\n /**\n * GHE requires version >=3.10 to support fine-grained access tokens\n * https://docs.github.com/en/enterprise-server@3.10/admin/release-notes#authentication\n */\n if (\n isGithubFineGrainedPersonalAccessToken(token) &&\n platformConfig.isGhe &&\n (!platformConfig.gheVersion ||\n semver.lt(platformConfig.gheVersion, '3.10.0'))\n ) {\n throw new Error(\n 'Init: Fine-grained Personal Access Tokens do not support GitHub Enterprise Server API version <3.10 and cannot be used with Renovate.',\n );\n }\n\n let renovateUsername: string;\n if (username) {\n renovateUsername = username;\n } else if (platformConfig.isGHApp) {\n platformConfig.userDetails ??= await getAppDetails(token);\n renovateUsername = platformConfig.userDetails.username;\n } else {\n platformConfig.userDetails ??= await getUserDetails(\n platformConfig.endpoint,\n token,\n );\n renovateUsername = platformConfig.userDetails.username;\n }\n\n let ghHostname: string;\n /* v8 ignore next -- false negative due to V8/source-map artifact */\n if (platformConfig.isGheCloud) {\n ghHostname = 'ghe.com';\n } else if (platformConfig.isGhe) {\n // valid url ensured at the function start\n const parsedEndpoint = parseUrl(platformConfig.endpoint)!;\n ghHostname = parsedEndpoint.hostname;\n } else {\n ghHostname = 'github.com';\n }\n\n let discoveredGitAuthor: string | undefined;\n if (!gitAuthor) {\n if (platformConfig.isGHApp) {\n platformConfig.userDetails ??= await getAppDetails(token);\n discoveredGitAuthor = `${platformConfig.userDetails.name} <${platformConfig.userDetails.id}+${platformConfig.userDetails.username}@users.noreply.${ghHostname}>`;\n } else {\n platformConfig.userDetails ??= await getUserDetails(\n platformConfig.endpoint,\n token,\n );\n // v8 ignore next -- TODO: coverage error #40625\n platformConfig.userEmail =\n platformConfig.userDetails.email ??\n (await getUserEmail(platformConfig.endpoint, token));\n if (platformConfig.userEmail) {\n discoveredGitAuthor = `${platformConfig.userDetails.name} <${platformConfig.userEmail}>`;\n }\n }\n }\n\n git.setPlatformIgnoredAuthors([`noreply@${ghHostname}`]);\n\n logger.debug({ platformConfig, renovateUsername }, 'Platform config');\n const platformResult: PlatformResult = {\n endpoint: platformConfig.endpoint,\n gitAuthor: gitAuthor ?? discoveredGitAuthor,\n renovateUsername,\n token,\n };\n\n warnIfDefaultGitAuthorEmail(platformResult.gitAuthor, platformConfig.isGhe);\n\n if (\n getEnv().RENOVATE_X_GITHUB_HOST_RULES &&\n platformResult.endpoint === 'https://api.github.com/'\n ) {\n logger.debug('Adding GitHub token as GHCR password');\n platformResult.hostRules = [\n {\n matchHost: 'ghcr.io',\n hostType: 'docker',\n username: 'USERNAME',\n password: token.replace(regEx(/^x-access-token:/), ''),\n },\n ];\n logger.debug('Adding GitHub token as npm.pkg.github.com Basic token');\n platformResult.hostRules.push({\n matchHost: 'npm.pkg.github.com',\n hostType: 'npm',\n token: token.replace(regEx(/^x-access-token:/), ''),\n });\n const usernamePasswordHostTypes = ['rubygems', 'maven', 'nuget'];\n for (const hostType of usernamePasswordHostTypes) {\n logger.debug(\n `Adding GitHub token as ${hostType}.pkg.github.com password`,\n );\n platformResult.hostRules.push({\n hostType,\n matchHost: `${hostType}.pkg.github.com`,\n username: renovateUsername,\n password: token.replace(regEx(/^x-access-token:/), ''),\n });\n }\n }\n return platformResult;\n}\n\nasync function fetchRepositories(): Promise<GhRestRepo[]> {\n try {\n if (isGHApp()) {\n const res = await githubApi.getJsonUnchecked<{\n repositories: GhRestRepo[];\n }>(`installation/repositories?per_page=100`, {\n paginationField: 'repositories',\n paginate: 'all',\n });\n return res.body.repositories;\n }\n const res = await githubApi.getJsonUnchecked<GhRestRepo[]>(\n `user/repos?per_page=100`,\n { paginate: 'all' },\n );\n return res.body;\n } catch (err) /* v8 ignore next -- defensive: repo listing failures are logged and rethrown, not simulated in specs */ {\n logger.error({ err }, `GitHub getRepos error`);\n throw err;\n }\n}\n\n// Get all repositories that the user has access to\nexport async function getRepos(config?: AutodiscoverConfig): Promise<string[]> {\n logger.debug('Autodiscovering GitHub repositories');\n const nonEmptyRepositories = (await fetchRepositories()).filter(\n isNonEmptyObject,\n );\n const nonArchivedRepositories = nonEmptyRepositories.filter(\n (repo) => !repo.archived,\n );\n if (nonArchivedRepositories.length < nonEmptyRepositories.length) {\n logger.debug(\n `Filtered out ${\n nonEmptyRepositories.length - nonArchivedRepositories.length\n } archived repositories`,\n );\n }\n if (!config?.topics) {\n return nonArchivedRepositories.map((repo) => repo.full_name);\n }\n\n logger.debug({ topics: config.topics }, 'Filtering by topics');\n const topicRepositories = nonArchivedRepositories.filter((repo) =>\n repo.topics?.some((topic) => config?.topics?.includes(topic)),\n );\n\n // v8 ignore else -- TODO: add test #40625\n if (topicRepositories.length < nonArchivedRepositories.length) {\n logger.debug(\n `Filtered out ${\n nonArchivedRepositories.length - topicRepositories.length\n } repositories not matching topic filters`,\n );\n }\n return topicRepositories.map((repo) => repo.full_name);\n}\n\nasync function getBranchProtection(\n branchName: string,\n): Promise<GithubBranchProtection> {\n if (config.parentRepo) {\n return {};\n }\n\n const res = await githubApi.getJson(\n `repos/${config.repository}/branches/${escapeHash(branchName)}/protection`,\n { cacheProvider: repoCacheProvider },\n GithubBranchProtection,\n );\n return res.body;\n}\n\nasync function getBranchRulesets(\n branchName: string,\n): Promise<GithubBranchRulesets> {\n if (config.parentRepo) {\n return [];\n }\n\n try {\n const res = await githubApi.getJson(\n `repos/${config.repository}/rules/branches/${escapeHash(branchName)}`,\n { cacheProvider: repoCacheProvider },\n GithubBranchRulesets,\n );\n return res.body;\n } catch (err) {\n if (err.statusCode === 404) {\n logger.debug(`No branch rulesets found for ${branchName}`);\n return [];\n }\n throw err;\n }\n}\n\nexport async function getRawFile(\n fileName: string,\n repoName?: string,\n branchOrTag?: string,\n): Promise<string | null> {\n const repo = repoName ?? config.repository;\n\n // only use cache for the same org\n const httpOptions: GithubHttpOptions = {};\n const isSameOrg = repo?.split('/')?.[0] === config.repositoryOwner;\n // v8 ignore else -- TODO: add test #40625\n if (isSameOrg) {\n httpOptions.cacheProvider = repoCacheProvider;\n }\n\n let url = `repos/${repo}/contents/${fileName}`;\n if (branchOrTag) {\n url += `?ref=${branchOrTag}`;\n }\n const res = await githubApi.getJsonUnchecked<{ content: string }>(\n url,\n httpOptions,\n );\n const buf = res.body.content;\n const str = fromBase64(buf);\n return str;\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 listForks(\n token: string,\n repository: string,\n): Promise<GhRestRepo[]> {\n try {\n // Get list of existing repos\n const url = `repos/${repository}/forks?per_page=100`;\n const repos = (\n await githubApi.getJsonUnchecked<GhRestRepo[]>(url, {\n token,\n paginate: true,\n pageLimit: 100,\n })\n ).body;\n logger.debug(`Found ${repos.length} forked repo(s)`);\n return repos;\n } catch (err) {\n if (err.statusCode === 404) {\n logger.debug('Cannot list repo forks - it is likely private');\n } else {\n logger.debug({ err }, 'Unknown error listing repository forks');\n }\n throw new Error(REPOSITORY_CANNOT_FORK);\n }\n}\n\nexport async function findFork(\n token: string,\n repository: string,\n forkOrg?: string,\n): Promise<GhRestRepo | null> {\n const forks = await listForks(token, repository);\n if (forkOrg) {\n logger.debug(`Searching for forked repo in forkOrg (${forkOrg})`);\n const forkedRepo = forks.find((repo) => repo.owner.login === forkOrg);\n if (forkedRepo) {\n logger.debug(`Found repo in forkOrg: ${forkedRepo.full_name}`);\n return forkedRepo;\n }\n logger.debug(`No repo found in forkOrg`);\n }\n logger.debug(`Searching for forked repo in user account`);\n try {\n const { username } = await getUserDetails(platformConfig.endpoint, token);\n const forkedRepo = forks.find((repo) => repo.owner.login === username);\n if (forkedRepo) {\n logger.debug(`Found repo in user account: ${forkedRepo.full_name}`);\n return forkedRepo;\n }\n } catch {\n throw new Error(REPOSITORY_CANNOT_FORK);\n }\n logger.debug(`No repo found in user account`);\n return null;\n}\n\nexport async function createFork(\n token: string,\n repository: string,\n forkOrg?: string,\n): Promise<GhRestRepo> {\n let forkedRepo: GhRestRepo | undefined;\n try {\n forkedRepo = (\n await githubApi.postJson<GhRestRepo>(`repos/${repository}/forks`, {\n token,\n body: {\n organization: forkOrg ?? undefined,\n name: config.parentRepo!.replace('/', '-_-'),\n default_branch_only: true, // no baseBranchPatterns support yet\n },\n })\n ).body;\n } catch (err) {\n logger.debug({ err }, 'Error creating fork');\n }\n if (!forkedRepo) {\n throw new Error(REPOSITORY_CANNOT_FORK);\n }\n logger.info({ forkedRepo: forkedRepo.full_name }, 'Created forked repo');\n logger.debug(`Sleeping 30s after creating fork`);\n await setTimeout(30000);\n return forkedRepo;\n}\n\n// Initialize GitHub by getting base branch and SHA\nexport async function initRepo({\n repository,\n forkCreation,\n forkOrg,\n forkToken,\n gitUrl,\n renovateUsername,\n cloneSubmodules,\n cloneSubmodulesFilter,\n}: RepoParams): Promise<RepoResult> {\n logger.debug(`initRepo(\"${repository}\")`);\n // config is used by the platform api itself, not necessary for the app layer to know\n config = {\n repository,\n cloneSubmodules,\n cloneSubmodulesFilter,\n ignorePrAuthor: GlobalConfig.get('ignorePrAuthor'),\n mergeQueueEnabled: {},\n } as any;\n const opts = hostRules.find({\n hostType: 'github',\n url: platformConfig.endpoint,\n readOnly: true,\n });\n config.renovateUsername = renovateUsername;\n [config.repositoryOwner, config.repositoryName] = repository.split('/');\n let repo: GhRepo | undefined;\n let forkSshUrl: string | null = null;\n try {\n let infoQuery = repoInfoQuery;\n\n // GitHub Enterprise Server <3.3.0 doesn't support autoMergeAllowed and hasIssuesEnabled objects\n // TODO #22198\n if (\n platformConfig.isGhe &&\n // semver not null safe, accepts null and undefined\n semver.satisfies(platformConfig.gheVersion!, '<3.3.0')\n ) {\n infoQuery = infoQuery.replace(regEx(/\\n\\s*autoMergeAllowed\\s*\\n/), '\\n');\n infoQuery = infoQuery.replace(regEx(/\\n\\s*hasIssuesEnabled\\s*\\n/), '\\n');\n }\n\n // GitHub Enterprise Server <3.9.0 doesn't support hasVulnerabilityAlertsEnabled objects\n if (\n platformConfig.isGhe &&\n // semver not null safe, accepts null and undefined\n semver.satisfies(platformConfig.gheVersion!, '<3.9.0')\n ) {\n infoQuery = infoQuery.replace(\n regEx(/\\n\\s*hasVulnerabilityAlertsEnabled\\s*\\n/),\n '\\n',\n );\n }\n\n // GitHub Enterprise Server <3.12.0 doesn't support merge queues\n if (\n platformConfig.isGhe &&\n // semver not null safe, accepts null and undefined\n semver.satisfies(platformConfig.gheVersion!, '<3.12.0')\n ) {\n infoQuery = infoQuery.replace(\n regEx(/\\n\\s*mergeQueue\\s*\\{\\s*id\\s*\\}\\s*\\n/),\n '\\n',\n );\n }\n\n const res = await githubApi.requestGraphql<{\n repository: GhRepo;\n }>(infoQuery, {\n variables: {\n owner: config.repositoryOwner,\n name: config.repositoryName,\n ...(!config.ignorePrAuthor && { user: renovateUsername }),\n },\n readOnly: true,\n count: 1, // bypass graphql check\n });\n\n if (res?.errors) {\n if (res.errors.find((err) => err.type === 'RATE_LIMITED')) {\n logger.debug({ res }, 'GraphQL rate limit exceeded.');\n throw new Error(PLATFORM_RATE_LIMIT_EXCEEDED);\n }\n logger.debug({ res }, 'Unexpected GraphQL errors');\n throw new Error(PLATFORM_UNKNOWN_ERROR);\n }\n\n repo = res?.data?.repository;\n /* v8 ignore next -- defensive: GraphQL errors are handled above, a null repository is not mocked in specs */\n if (!repo) {\n logger.debug({ res }, 'No repository returned');\n throw new Error(REPOSITORY_NOT_FOUND);\n }\n /* v8 ignore next -- empty-repo detection via missing defaultBranchRef is not mocked in specs */\n if (!repo.defaultBranchRef?.name) {\n logger.debug(\n { res },\n 'No default branch returned - treating repo as empty',\n );\n throw new Error(REPOSITORY_EMPTY);\n }\n if (\n repo.nameWithOwner &&\n repo.nameWithOwner.toUpperCase() !== repository.toUpperCase()\n ) {\n logger.debug(\n { desiredRepo: repository, foundRepo: repo.nameWithOwner },\n 'Repository has been renamed',\n );\n throw new Error(REPOSITORY_RENAMED);\n }\n if (repo.isArchived) {\n logger.debug(\n 'Repository is archived - throwing error to abort renovation',\n );\n throw new Error(REPOSITORY_ARCHIVED);\n }\n // Use default branch as PR target unless later overridden.\n config.defaultBranch = repo.defaultBranchRef.name;\n // Base branch may be configured but defaultBranch is always fixed\n logger.debug(`${repository} default branch = ${config.defaultBranch}`);\n // GitHub allows administrators to block certain types of merge, so we need to check it\n if (repo.squashMergeAllowed) {\n config.mergeMethod = 'squash';\n } else if (repo.mergeCommitAllowed) {\n config.mergeMethod = 'merge';\n } else if (repo.rebaseMergeAllowed) {\n config.mergeMethod = 'rebase';\n } else {\n // This happens if we don't have Administrator read access, it is not a critical error\n logger.debug('Could not find allowed merge methods for repo');\n }\n config.autoMergeAllowed = repo.autoMergeAllowed;\n config.hasIssuesEnabled = repo.hasIssuesEnabled;\n config.hasVulnerabilityAlertsEnabled = repo.hasVulnerabilityAlertsEnabled;\n config.mergeQueueEnabled[config.defaultBranch] = isNonEmptyObject(\n repo.mergeQueue,\n );\n\n const recentIssues = Issue.array()\n .catch([])\n .parse(res?.data?.repository?.issues?.nodes);\n GithubIssueCache.addIssuesToReconcile(recentIssues);\n } catch (err) /* v8 ignore next -- initRepo error mapping needs failure shapes not mocked in specs */ {\n logger.debug({ err }, 'Caught initRepo error');\n if (\n err.message === REPOSITORY_ARCHIVED ||\n err.message === REPOSITORY_RENAMED ||\n err.message === REPOSITORY_NOT_FOUND\n ) {\n throw err;\n }\n if (err.statusCode === 403) {\n throw new Error(REPOSITORY_ACCESS_FORBIDDEN);\n }\n if (err.statusCode === 404) {\n throw new Error(REPOSITORY_NOT_FOUND);\n }\n if (err.message.startsWith('Repository access blocked')) {\n throw new Error(REPOSITORY_BLOCKED);\n }\n if (err.message === REPOSITORY_FORK_MODE_FORKED) {\n throw err;\n }\n if (err.message === REPOSITORY_FORKED) {\n throw err;\n }\n if (err.message === REPOSITORY_DISABLED) {\n throw err;\n }\n if (err.message === 'Response code 451 (Unavailable for Legal Reasons)') {\n throw new Error(REPOSITORY_ACCESS_FORBIDDEN);\n }\n logger.debug({ err }, 'Unknown GitHub initRepo error');\n throw err;\n }\n // This shouldn't be necessary, but occasional strange errors happened until it was added\n config.prList = null;\n\n if (forkToken) {\n logger.debug('Bot is in fork mode');\n if (repo.isFork) {\n logger.debug(\n `Forked repos cannot be processed when running with a forkToken, so this repo will be skipped`,\n );\n logger.debug(\n `Parent repo for this forked repo is ${repo.parent?.nameWithOwner}`,\n );\n throw new Error(REPOSITORY_FORKED);\n }\n config.forkOrg = forkOrg;\n config.forkToken = forkToken;\n // save parent name then delete\n config.parentRepo = config.repository;\n config.repository = null;\n let forkedRepo = await findFork(forkToken, repository, forkOrg);\n if (forkedRepo) {\n config.repository = forkedRepo.full_name;\n forkSshUrl = forkedRepo.ssh_url;\n const forkDefaultBranch = forkedRepo.default_branch;\n if (forkDefaultBranch !== config.defaultBranch) {\n const body = {\n ref: `refs/heads/${config.defaultBranch}`,\n sha: repo.defaultBranchRef.target.oid,\n };\n logger.debug(\n {\n defaultBranch: config.defaultBranch,\n forkDefaultBranch,\n body,\n },\n 'Fork has different default branch to parent, attempting to create branch',\n );\n try {\n await githubApi.postJson(`repos/${config.repository}/git/refs`, {\n body,\n token: forkToken,\n });\n logger.debug('Created new default branch in fork');\n } catch (err) /* v8 ignore next -- fork default-branch creation failures are not mocked in specs */ {\n if (err.response?.body?.message === 'Reference already exists') {\n logger.debug(\n `Branch ${config.defaultBranch} already exists in the fork`,\n );\n } else {\n logger.warn(\n { err, body: err.response?.body },\n 'Could not create parent defaultBranch in fork',\n );\n }\n }\n logger.debug(\n `Setting ${config.defaultBranch} as default branch for ${config.repository}`,\n );\n try {\n await githubApi.patchJson(`repos/${config.repository}`, {\n body: {\n name: config.repository.split('/')[1],\n default_branch: config.defaultBranch,\n },\n token: forkToken,\n });\n logger.debug('Successfully changed default branch for fork');\n } catch (err) /* v8 ignore next -- defensive: fork default-branch update failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Could not set default branch');\n }\n }\n } else if (forkCreation) {\n logger.debug('Forked repo is not found - attempting to create it');\n forkedRepo = await createFork(forkToken, repository, forkOrg);\n config.repository = forkedRepo.full_name;\n forkSshUrl = forkedRepo.ssh_url;\n } else {\n logger.debug('Forked repo is not found and forkCreation is disabled');\n throw new Error(REPOSITORY_FORK_MISSING);\n }\n }\n\n let authToken: string | null;\n if (forkToken) {\n logger.debug('Using forkToken for git init');\n authToken = coerceToNull(config.forkToken);\n } /* v8 ignore next -- token-type detection depends on opts.token shapes not varied in specs */ else {\n const tokenType = opts.token?.startsWith('x-access-token:')\n ? 'app'\n : 'personal access';\n logger.debug(`Using ${tokenType} token for git init`);\n authToken = opts.token ?? null;\n }\n // endpoint is validated during initPlatform\n const parsedEndpoint = parseUrl(platformConfig.endpoint)!;\n const workingSshUrl = forkToken ? forkSshUrl : repo.sshUrl;\n const url = getRepoUrl(\n config.repository!,\n gitUrl,\n workingSshUrl,\n parsedEndpoint,\n authToken,\n );\n let upstreamUrl: string | undefined;\n if (forkCreation && config.parentRepo) {\n upstreamUrl = getRepoUrl(\n config.parentRepo,\n gitUrl,\n repo.sshUrl,\n parsedEndpoint,\n authToken,\n );\n }\n await git.initRepo({\n ...config,\n url,\n upstreamUrl,\n });\n const repoConfig: RepoResult = {\n defaultBranch: config.defaultBranch,\n isFork: repo.isFork === true,\n repoFingerprint: repoFingerprint(repo.id, platformConfig.endpoint),\n };\n return repoConfig;\n}\n\nasync function checkRulesetsForForceRebase(\n branchName: string,\n): Promise<boolean> {\n try {\n const rulesets = await getBranchRulesets(branchName);\n logger.trace(\n `Ruleset: Found ${rulesets.length} rulesets for branch ${branchName}`,\n );\n\n return rulesets.some((rule) => {\n if (\n rule.type === 'required_status_checks' &&\n rule.parameters?.strict_required_status_checks_policy === true\n ) {\n logger.debug(\n `Ruleset: strict required status checks found for ${branchName}`,\n );\n return true;\n }\n\n return false;\n });\n } catch (err) {\n handleBranchProtectionError('rulesets', err, branchName);\n return false;\n }\n}\n\nasync function checkBranchProtectionForForceRebase(\n branchName: string,\n): Promise<boolean> {\n try {\n const branchProtection = await getBranchProtection(branchName);\n logger.trace(`Found branch protection for branch ${branchName}`);\n\n const strictStatusChecks = branchProtection?.required_status_checks?.strict;\n if (strictStatusChecks) {\n logger.debug(\n `Branch protection: PRs must be up-to-date before merging for ${branchName}`,\n );\n return true;\n }\n return false;\n } catch (err) {\n handleBranchProtectionError('branch-protection', err, branchName);\n return false;\n }\n}\n\nexport async function getBranchForceRebase(\n branchName: string,\n): Promise<boolean> {\n config.branchForceRebase ??= {};\n\n const cachedResult = config.branchForceRebase[branchName];\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n\n // Initialize to false before checking branch protection\n config.branchForceRebase[branchName] = false;\n\n // Check rulesets first (newer API)\n const hasRulesetForceRebase = await checkRulesetsForForceRebase(branchName);\n if (hasRulesetForceRebase) {\n config.branchForceRebase[branchName] = true;\n return true;\n }\n\n // Fall back to legacy branch protection\n const hasBranchProtectionForceRebase =\n await checkBranchProtectionForForceRebase(branchName);\n if (hasBranchProtectionForceRebase) {\n config.branchForceRebase[branchName] = true;\n }\n\n return config.branchForceRebase[branchName];\n}\n\nfunction handleBranchProtectionError(\n protection: 'branch-protection' | 'rulesets',\n err: any,\n branchName: string,\n): void {\n if (err.statusCode === 404) {\n logger.debug(`No ${protection} found for ${branchName}`);\n return;\n }\n\n const isUnauthorized =\n err.message === PLATFORM_INTEGRATION_UNAUTHORIZED || err.statusCode === 403;\n\n if (isUnauthorized) {\n logger.once.debug(\n `Branch protection: Do not have permissions to detect ${protection} for ${branchName}`,\n );\n return;\n }\n\n throw err;\n}\n\nfunction cachePr(pr?: GhPr | null): void {\n config.prList ??= [];\n // v8 ignore else -- TODO: add test #40625\n if (pr) {\n updatePrCache(pr);\n for (let idx = 0; idx < config.prList.length; idx += 1) {\n const cachedPr = config.prList[idx];\n if (cachedPr.number === pr.number) {\n config.prList[idx] = pr;\n return;\n }\n }\n config.prList.push(pr);\n }\n}\n\n// Fetch fresh Pull Request and cache it when possible\nasync function fetchPr(prNo: number): Promise<GhPr | null> {\n try {\n const { body: ghRestPr } = await githubApi.getJsonUnchecked<GhRestPr>(\n `repos/${config.parentRepo ?? config.repository}/pulls/${prNo}`,\n );\n const result = coerceRestPr(ghRestPr);\n cachePr(result);\n return result;\n } catch (err) {\n logger.warn({ err, prNo }, `GitHub fetchPr error`);\n return null;\n }\n}\n\n// Gets details for a PR\nexport async function getPr(prNo: number): Promise<GhPr | null> {\n if (!prNo) {\n return null;\n }\n const prList = await getPrList();\n let pr = prList.find(({ number }) => number === prNo) ?? null;\n if (pr) {\n logger.debug('Returning PR from cache');\n }\n pr ??= await fetchPr(prNo);\n return pr;\n}\n\nfunction matchesState(state: string, desiredState: string): boolean {\n if (desiredState === 'all') {\n return true;\n }\n if (desiredState.startsWith('!')) {\n return state !== desiredState.substring(1);\n }\n return state === desiredState;\n}\n\nexport async function getPrList(): Promise<GhPr[]> {\n if (!config.prList) {\n const repo = config.parentRepo ?? config.repository;\n\n let username = config.renovateUsername;\n if (config.forkToken || config.ignorePrAuthor) {\n username = undefined;\n }\n\n // TODO: check null `repo` (#22198)\n const prCache = await instrument('getPrCache', () =>\n getPrCache(githubApi, repo!, username),\n );\n config.prList = Object.values(prCache).sort(\n ({ number: a }, { number: b }) => b - a,\n );\n }\n\n return config.prList;\n}\n\nexport async function findPr({\n branchName,\n prTitle,\n state = 'all',\n includeOtherAuthors,\n}: FindPRConfig): Promise<GhPr | null> {\n logger.debug(`findPr(${branchName}, ${prTitle}, ${state})`);\n\n if (includeOtherAuthors) {\n const repo = config.parentRepo ?? config.repository;\n const org = repo?.split('/')[0];\n // PR might have been created by anyone, so don't use the cached Renovate PR list\n const { body: prList } = await githubApi.getJsonUnchecked<GhRestPr[]>(\n `repos/${repo}/pulls?head=${org}:${branchName}&state=open`,\n { cacheProvider: repoCacheProvider },\n );\n\n if (!prList.length) {\n logger.debug(`No PR found for branch ${branchName}`);\n return null;\n }\n\n return coerceRestPr(prList[0]);\n }\n\n const prList = await getPrList();\n const pr = prList.find((p) => {\n if (p.sourceBranch !== branchName) {\n return false;\n }\n\n if (prTitle && prTitle.toUpperCase() !== p.title.toUpperCase()) {\n return false;\n }\n\n if (!matchesState(p.state, state)) {\n return false;\n }\n\n if (!config.forkToken && !looseEquals(config.repository, p.sourceRepo)) {\n return false;\n }\n\n return true;\n });\n if (pr) {\n logger.debug(`Found PR #${pr.number}`);\n }\n return pr ?? null;\n}\n\nasync function ensureBranchSha(\n branchName: string,\n sha: LongCommitSha,\n): Promise<void> {\n const repository = config.repository!;\n try {\n const commitUrl = `/repos/${repository}/git/commits/${sha}`;\n await githubApi.head(commitUrl, { memCache: false });\n } catch (err) {\n logger.error({ err, sha, branchName }, 'Commit not found');\n throw err;\n }\n\n const refUrl = `/repos/${config.repository}/git/refs/heads/${branchName}`;\n const branchExists = await remoteBranchExists(repository, branchName);\n\n if (branchExists) {\n try {\n await githubApi.patchJson(refUrl, { body: { sha, force: true } });\n return;\n } catch (err) {\n if (err.err?.response?.statusCode === 422) {\n logger.debug(\n { err },\n 'Branch update failed due to reference not existing - will try to create',\n );\n } else {\n logger.warn({ refUrl, err }, 'Error updating branch');\n throw err;\n }\n }\n }\n\n await githubApi.postJson(`/repos/${repository}/git/refs`, {\n body: { sha, ref: `refs/heads/${branchName}` },\n });\n}\n\n// Returns the Pull Request for a branch. Null if not exists.\nexport async function getBranchPr(branchName: string): Promise<GhPr | null> {\n logger.debug(`getBranchPr(${branchName})`);\n\n const openPr = await findPr({\n branchName,\n state: 'open',\n });\n\n if (openPr) {\n return openPr;\n }\n\n return null;\n}\n\nexport async function tryReuseAutoclosedPr(\n autoclosedPr: Pr,\n newTitle: string,\n): Promise<Pr | null> {\n const { sha, number, sourceBranch: branchName } = autoclosedPr;\n try {\n await ensureBranchSha(branchName, sha!);\n logger.debug(`Recreated autoclosed branch ${branchName} with sha ${sha}`);\n } catch (err) {\n logger.debug(\n { err, branchName, sha, autoclosedPr },\n 'Could not recreate autoclosed branch - skipping reopen',\n );\n return null;\n }\n\n try {\n const { body: ghPr } = await githubApi.patchJson<GhRestPr>(\n `repos/${config.repository}/pulls/${number}`,\n {\n body: {\n state: 'open',\n title: newTitle,\n },\n },\n );\n logger.info(\n { branchName, oldTitle: autoclosedPr.title, newTitle, number },\n 'Successfully reopened autoclosed PR',\n );\n\n const result = coerceRestPr(ghPr);\n\n const localSha = git.getBranchCommit(branchName);\n // v8 ignore else -- TODO: add test #40625\n if (localSha && localSha !== sha) {\n await git.forcePushToRemote(branchName, 'origin');\n result.sha = localSha;\n }\n\n cachePr(result);\n return result;\n } catch {\n logger.debug('Could not reopen autoclosed PR');\n return null;\n }\n}\n\nasync function getStatus(\n branchName: string,\n useCache = true,\n): Promise<CombinedBranchStatus> {\n const branch = escapeHash(branchName);\n const url = `repos/${config.repository}/commits/${branch}/status`;\n\n const { body: status } =\n await githubApi.getJsonUnchecked<CombinedBranchStatus>(url, {\n memCache: useCache,\n cacheProvider: repoCacheProvider,\n });\n\n return status;\n}\n\n// Returns the combined status for a branch.\nexport async function getBranchStatus(\n branchName: string,\n internalChecksAsSuccess: boolean,\n): Promise<BranchStatus> {\n logger.debug(`getBranchStatus(${branchName})`);\n let commitStatus: CombinedBranchStatus;\n try {\n commitStatus = await getStatus(branchName);\n } catch (err) /* v8 ignore next -- 404-to-REPOSITORY_CHANGED mapping for deleted branches is not mocked in specs */ {\n if (err.statusCode === 404) {\n logger.debug(\n 'Received 404 when checking branch status, assuming that branch has been deleted',\n );\n throw new Error(REPOSITORY_CHANGED);\n }\n logger.debug('Unknown error when checking branch status');\n throw err;\n }\n logger.debug(\n { state: commitStatus.state, statuses: commitStatus.statuses },\n 'branch status check result',\n );\n if (commitStatus.statuses && !internalChecksAsSuccess) {\n commitStatus.statuses = commitStatus.statuses.filter(\n (status) =>\n status.state !== 'success' || !status.context?.startsWith('renovate/'),\n );\n // v8 ignore else -- TODO: add test #40625\n if (!commitStatus.statuses.length) {\n logger.debug(\n 'Successful checks are all internal renovate/ checks, so returning \"pending\" branch status',\n );\n commitStatus.state = 'pending';\n }\n }\n let checkRuns: { name: string; status: string; conclusion: string }[] = [];\n // API is supported in oldest available GHE version 2.19\n try {\n const checkRunsUrl = `repos/${config.repository}/commits/${escapeHash(\n branchName,\n )}/check-runs?per_page=100`;\n const opts = {\n headers: {\n accept: 'application/vnd.github.antiope-preview+json',\n },\n paginate: true,\n paginationField: 'check_runs',\n cacheProvider: memCacheProvider,\n };\n const checkRunsRaw = (\n await githubApi.getJsonUnchecked<{\n check_runs: { name: string; status: string; conclusion: string }[];\n }>(checkRunsUrl, opts)\n ).body;\n if (checkRunsRaw.check_runs?.length) {\n checkRuns = checkRunsRaw.check_runs.map((run) => ({\n name: run.name,\n status: run.status,\n conclusion: run.conclusion,\n }));\n logger.debug({ checkRuns }, 'check runs result');\n } /* v8 ignore next -- specs always mock a non-empty check_runs response */ else {\n logger.debug({ result: checkRunsRaw }, 'No check runs found');\n }\n } catch (err) /* v8 ignore next -- check-run permission errors (403) are mapped to empty results, not mocked in specs */ {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n if (\n err.statusCode === 403 ||\n err.message === PLATFORM_INTEGRATION_UNAUTHORIZED\n ) {\n logger.debug('No permission to view check runs');\n } else {\n logger.warn({ err }, 'Error retrieving check runs');\n }\n }\n if (checkRuns.length === 0) {\n if (commitStatus.state === 'success') {\n return 'green';\n }\n if (commitStatus.state === 'failure') {\n return 'red';\n }\n return 'yellow';\n }\n if (\n commitStatus.state === 'failure' ||\n checkRuns.some((run) => run.conclusion === 'failure')\n ) {\n return 'red';\n }\n if (\n (commitStatus.state === 'success' || commitStatus.statuses.length === 0) &&\n checkRuns.every((run) =>\n ['skipped', 'neutral', 'success'].includes(run.conclusion),\n )\n ) {\n return 'green';\n }\n return 'yellow';\n}\n\nasync function getStatusCheck(\n branchName: string,\n useCache = true,\n): Promise<GhBranchStatus[]> {\n const branchCommit = git.getBranchCommit(branchName);\n\n const url = `repos/${config.repository}/commits/${branchCommit}/statuses`;\n\n const opts: GithubHttpOptions = useCache\n ? { cacheProvider: memCacheProvider }\n : { memCache: false };\n\n return (await githubApi.getJsonUnchecked<GhBranchStatus[]>(url, opts)).body;\n}\n\ntype GithubToRenovateStatusMapping = Record<string, BranchStatus>;\nconst githubToRenovateStatusMapping: GithubToRenovateStatusMapping = {\n success: 'green',\n error: 'red',\n failure: 'red',\n pending: 'yellow',\n};\n\nexport async function getBranchStatusCheck(\n branchName: string,\n context: string,\n): Promise<BranchStatus | null> {\n try {\n const res = await getStatusCheck(branchName);\n for (const check of res) {\n if (check.context === context) {\n return githubToRenovateStatusMapping[check.state] || 'yellow';\n }\n }\n return null;\n } catch (err) /* v8 ignore next -- 404-to-REPOSITORY_CHANGED mapping for missing commits is not mocked in specs */ {\n if (err.statusCode === 404) {\n logger.debug('Commit not found when checking statuses');\n throw new Error(REPOSITORY_CHANGED);\n }\n throw err;\n }\n}\n\nexport async function setBranchStatus({\n branchName,\n context,\n description,\n state,\n url: targetUrl,\n}: BranchStatusConfig): Promise<void> {\n /* v8 ignore next -- specs do not run setBranchStatus in forking mode */\n if (config.parentRepo) {\n logger.debug('Cannot set branch status when in forking mode');\n return;\n }\n const existingStatus = await getBranchStatusCheck(branchName, context);\n if (existingStatus === state) {\n return;\n }\n logger.debug({ branch: branchName, context, state }, 'Setting branch status');\n let url: string | undefined;\n try {\n const branchCommit = git.getBranchCommit(branchName);\n url = `repos/${config.repository}/statuses/${branchCommit}`;\n const renovateToGitHubStateMapping = {\n green: 'success',\n yellow: 'pending',\n red: 'failure',\n };\n const options: any = {\n state: renovateToGitHubStateMapping[state],\n description,\n context,\n };\n // v8 ignore else -- TODO: add test #40625\n if (targetUrl) {\n options.target_url = targetUrl;\n }\n await githubApi.postJson(url, { body: options });\n\n // update status cache\n await getStatus(branchName, false);\n await getStatusCheck(branchName, false);\n } catch (err) /* v8 ignore next -- defensive: status POST failures abort with REPOSITORY_CHANGED, not simulated in specs */ {\n logger.debug({ err, url }, 'Caught error setting branch status - aborting');\n throw new Error(REPOSITORY_CHANGED);\n }\n}\n\n// Issue\n\nasync function getIssues(): Promise<Issue[]> {\n const result = await githubApi.queryRepoField<unknown>(\n getIssuesQuery,\n 'issues',\n {\n variables: {\n owner: config.repositoryOwner,\n name: config.repositoryName,\n ...(!config.ignorePrAuthor && { user: config.renovateUsername }),\n },\n readOnly: true,\n },\n );\n\n logger.debug(`Retrieved ${result.length} issues`);\n return Issue.array().parse(result);\n}\n\nexport async function getIssueList(): Promise<Issue[]> {\n /* v8 ignore next -- specs initialize repos with issues enabled */\n if (config.hasIssuesEnabled === false) {\n return [];\n }\n let issueList = GithubIssueCache.getIssues();\n // v8 ignore else -- TODO: add test #40625\n if (!issueList) {\n logger.debug('Retrieving issueList');\n issueList = await getIssues();\n GithubIssueCache.setIssues(issueList);\n }\n return issueList;\n}\n\nexport async function getIssue(number: number): Promise<Issue | null> {\n if (config.hasIssuesEnabled === false) {\n return null;\n }\n try {\n const repo = config.parentRepo ?? config.repository;\n const { body: issue } = await githubApi.getJson(\n `repos/${repo}/issues/${number}`,\n {\n cacheProvider: repoCacheProvider,\n },\n Issue,\n );\n GithubIssueCache.updateIssue(issue);\n return issue;\n } catch (err) {\n logger.debug({ err, number }, 'Error getting issue');\n if (err.response?.statusCode === 410) {\n logger.debug(`Issue #${number} has been deleted`);\n GithubIssueCache.deleteIssue(number);\n }\n return null;\n }\n}\n\nexport async function findIssue(title: string): Promise<Issue | null> {\n logger.debug(`findIssue(${title})`);\n const [issue] = (await getIssueList()).filter(\n (i) => i.state === 'open' && i.title === title,\n );\n if (!issue) {\n return null;\n }\n logger.debug(`Found issue ${issue.number}`);\n return getIssue(issue.number);\n}\n\nasync function closeIssue(issueNumber: number): Promise<void> {\n logger.debug(`closeIssue(${issueNumber})`);\n const repo = config.parentRepo ?? config.repository;\n try {\n const { body: closedIssue } = await githubApi.patchJson(\n `repos/${repo}/issues/${issueNumber}`,\n { body: { state: 'closed' } },\n Issue,\n );\n GithubIssueCache.updateIssue(closedIssue);\n } catch (err) {\n const statusCode = err.response?.statusCode;\n if (statusCode === 404 || statusCode === 410) {\n logger.debug(\n `Issue #${issueNumber} no longer exists on the platform, removing from cache`,\n );\n GithubIssueCache.deleteIssue(issueNumber);\n return;\n }\n throw err;\n }\n}\n\nexport async function ensureIssue({\n title,\n reuseTitle,\n body: rawBody,\n labels,\n once = false,\n shouldReOpen = true,\n}: EnsureIssueConfig): Promise<EnsureIssueResult | null> {\n logger.debug(`ensureIssue(${title})`);\n /* v8 ignore next -- specs initialize repos with issues enabled */\n if (config.hasIssuesEnabled === false) {\n logger.info(\n 'Cannot ensure issue because issues are disabled in this repository',\n );\n return null;\n }\n const body = sanitize(rawBody);\n try {\n const issueList = await getIssueList();\n let issues = issueList.filter((i) => i.title === title);\n if (!issues.length) {\n issues = issueList.filter((i) => i.title === reuseTitle);\n if (issues.length) {\n logger.debug(`Reusing issue title: \"${reuseTitle}\"`);\n }\n }\n if (issues.length) {\n let issue = issues.find((i) => i.state === 'open');\n if (!issue) {\n if (once) {\n logger.debug('Issue already closed - skipping recreation');\n return null;\n }\n if (shouldReOpen) {\n logger.debug('Reopening previously closed issue');\n }\n issue = issues.at(-1)!;\n }\n for (const i of issues) {\n if (i.state === 'open' && i.number !== issue.number) {\n logger.warn({ issueNo: i.number }, 'Closing duplicate issue');\n await closeIssue(i.number);\n }\n }\n\n const repo = config.parentRepo ?? config.repository;\n const { body: serverIssue } = await githubApi.getJson(\n `repos/${repo}/issues/${issue.number}`,\n { cacheProvider: repoCacheProvider },\n Issue,\n );\n GithubIssueCache.updateIssue(serverIssue);\n\n if (\n issue.title === title &&\n serverIssue.body === body &&\n issue.state === 'open'\n ) {\n logger.debug('Issue is open and up to date - nothing to do');\n return null;\n }\n if (shouldReOpen || issue.state === 'open') {\n logger.debug('Patching issue');\n const data: Record<string, unknown> = { body, state: 'open', title };\n if (labels) {\n data.labels = labels;\n }\n const repo = config.parentRepo ?? config.repository;\n const { body: updatedIssue } = await githubApi.patchJson(\n `repos/${repo}/issues/${issue.number}`,\n { body: data },\n Issue,\n );\n GithubIssueCache.updateIssue(updatedIssue);\n logger.debug('Issue updated');\n return 'updated';\n }\n }\n const { body: createdIssue } = await githubApi.postJson(\n `repos/${config.parentRepo ?? config.repository}/issues`,\n {\n body: {\n title,\n body,\n labels: labels ?? [],\n },\n },\n Issue,\n );\n logger.info('Issue created');\n // reset issueList so that it will be fetched again as-needed\n GithubIssueCache.updateIssue(createdIssue);\n return 'created';\n } catch (err) /* v8 ignore next -- issue creation failure handling is not mocked in specs */ {\n if (err.body?.message?.startsWith('Issues are disabled for this repo')) {\n logger.debug(`Issues are disabled, so could not create issue: ${title}`);\n } else {\n logger.warn({ err }, 'Could not ensure issue');\n }\n }\n return null;\n}\n\nexport async function ensureIssueClosing(title: string): Promise<void> {\n logger.trace(`ensureIssueClosing(${title})`);\n /* v8 ignore next -- specs initialize repos with issues enabled */\n if (config.hasIssuesEnabled === false) {\n return;\n }\n const issueList = await getIssueList();\n for (const issue of issueList) {\n if (issue.state === 'open' && issue.title === title) {\n await closeIssue(issue.number);\n logger.debug(`Issue closed, issueNo: ${issue.number}`);\n }\n }\n}\n\nasync function tryAddMilestone(\n issueNo: number,\n milestoneNo: number | undefined,\n): Promise<void> {\n if (!milestoneNo) {\n return;\n }\n\n logger.debug(\n {\n milestone: milestoneNo,\n pr: issueNo,\n },\n 'Adding milestone to PR',\n );\n try {\n const repo = config.parentRepo ?? config.repository;\n const { body: updatedIssue } = await githubApi.patchJson(\n `repos/${repo}/issues/${issueNo}`,\n { body: { milestone: milestoneNo } },\n Issue,\n );\n GithubIssueCache.updateIssue(updatedIssue);\n } catch (err) {\n /* v8 ignore next -- defensive: the raw-error fallback is for non-HTTP failures not seen in specs */\n const actualError = err.response?.body ?? err;\n logger.warn(\n {\n milestone: milestoneNo,\n pr: issueNo,\n err: actualError,\n },\n 'Unable to add milestone to PR',\n );\n }\n}\n\nexport async function addAssignees(\n issueNo: number,\n assignees: string[],\n): Promise<void> {\n logger.debug(`Adding assignees '${assignees.join(', ')}' to #${issueNo}`);\n const repository = config.parentRepo ?? config.repository;\n const url = `repos/${repository}/issues/${issueNo}/assignees`;\n let lastErr: Error | undefined;\n for (let attempt = 0; attempt < 3; attempt += 1) {\n try {\n const { body: updatedIssue } = await githubApi.postJson(\n url,\n { body: { assignees } },\n Issue,\n );\n GithubIssueCache.updateIssue(updatedIssue);\n return;\n } catch (err) {\n if (err.statusCode !== 404) {\n throw err;\n }\n lastErr = err;\n logger.debug(\n { attempt: attempt + 1 },\n `Retrying addAssignees for #${issueNo} after 404`,\n );\n await setTimeout(1000);\n }\n }\n throw lastErr!;\n}\n\nexport async function addReviewers(\n prNo: number,\n reviewers: string[],\n): Promise<void> {\n logger.debug(`Adding reviewers '${reviewers.join(', ')}' to #${prNo}`);\n\n const userReviewers = reviewers.filter((e) => !e.startsWith('team:'));\n const teamReviewers = reviewers\n .filter((e) => e.startsWith('team:'))\n .map((e) => e.replace(regEx(/^team:/), ''));\n try {\n await githubApi.postJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/pulls/${prNo}/requested_reviewers`,\n {\n body: {\n reviewers: userReviewers,\n team_reviewers: teamReviewers,\n },\n },\n );\n } catch (err) /* v8 ignore next -- defensive: reviewer assignment failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Failed to assign reviewer');\n }\n}\n\nexport async function addLabels(\n issueNo: number,\n labels: string[] | null | undefined,\n): Promise<void> {\n logger.debug(`Adding labels '${labels?.join(', ')}' to #${issueNo}`);\n try {\n const repository = config.parentRepo ?? config.repository;\n if (isArray(labels) && labels.length) {\n await githubApi.postJson(`repos/${repository}/issues/${issueNo}/labels`, {\n body: labels,\n });\n }\n } catch (err) /* v8 ignore next -- defensive: label-adding failures are logged and swallowed, not simulated in specs */ {\n logger.warn(\n { err, issueNo, labels },\n 'Error while adding labels. Skipping',\n );\n }\n}\n\nexport async function deleteLabel(\n issueNo: number,\n label: string,\n): Promise<void> {\n logger.debug(`Deleting label ${label} from #${issueNo}`);\n const repository = config.parentRepo ?? config.repository;\n try {\n await githubApi.deleteJson(\n `repos/${repository}/issues/${issueNo}/labels/${label}`,\n );\n } catch (err) /* v8 ignore next -- defensive: label deletion failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err, issueNo, label }, 'Failed to delete label');\n }\n}\n\nasync function addComment(issueNo: number, body: string): Promise<void> {\n // POST /repos/:owner/:repo/issues/:number/comments\n await githubApi.postJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/issues/${issueNo}/comments`,\n {\n body: { body },\n },\n );\n}\n\nasync function editComment(commentId: number, body: string): Promise<void> {\n // PATCH /repos/:owner/:repo/issues/comments/:id\n await githubApi.patchJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/issues/comments/${commentId}`,\n {\n body: { body },\n },\n );\n}\n\nasync function deleteComment(commentId: number): Promise<void> {\n // DELETE /repos/:owner/:repo/issues/comments/:id\n await githubApi.deleteJson(\n `repos/${\n config.parentRepo ?? config.repository\n }/issues/comments/${commentId}`,\n );\n}\n\nasync function getComments(issueNo: number): Promise<Comment[]> {\n // GET /repos/:owner/:repo/issues/:number/comments\n logger.debug(`Getting comments for #${issueNo}`);\n const repo = config.parentRepo ?? config.repository;\n const url = `repos/${repo}/issues/${issueNo}/comments?per_page=100`;\n try {\n const { body: comments } = await githubApi.getJsonUnchecked<Comment[]>(\n url,\n {\n paginate: true,\n cacheProvider: repoCacheProvider,\n },\n );\n logger.debug(`Found ${comments.length} comments`);\n return comments;\n } catch (err) /* v8 ignore next -- comment-fetch 404s are wrapped as ExternalHostError, not mocked in specs */ {\n if (err.statusCode === 404) {\n logger.debug('404 response when retrieving comments');\n throw new ExternalHostError(err, 'github');\n }\n throw err;\n }\n}\n\nexport async function ensureComment({\n number,\n topic,\n content,\n}: EnsureCommentConfig): Promise<boolean> {\n const sanitizedContent = sanitize(content);\n try {\n const comments = await getComments(number);\n let body: string;\n let commentId: number | null = null;\n let commentNeedsUpdating = false;\n if (topic) {\n logger.debug(`Ensuring comment \"${topic}\" in #${number}`);\n body = `### ${topic}\\n\\n${sanitizedContent}`;\n comments.forEach((comment) => {\n if (comment.body.startsWith(`### ${topic}\\n\\n`)) {\n commentId = comment.id;\n commentNeedsUpdating = comment.body !== body;\n }\n });\n } else {\n logger.debug(`Ensuring content-only comment in #${number}`);\n body = `${sanitizedContent}`;\n comments.forEach((comment) => {\n // v8 ignore else -- TODO: add test #40625\n if (comment.body === body) {\n commentId = comment.id;\n commentNeedsUpdating = false;\n }\n });\n }\n if (!commentId) {\n await addComment(number, body);\n logger.info(\n { repository: config.repository, issueNo: number, topic },\n 'Comment added',\n );\n } else if (commentNeedsUpdating) {\n await editComment(commentId, body);\n logger.debug(\n { repository: config.repository, issueNo: number },\n 'Comment updated',\n );\n } else {\n logger.debug('Comment is already up-to-date');\n }\n return true;\n } catch (err) /* v8 ignore next -- comment API failure handling (locked issues) is not mocked in specs */ {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n if (err.body?.message?.includes('is locked')) {\n logger.debug('Issue is locked - cannot add comment');\n } else {\n logger.warn({ err }, 'Error ensuring comment');\n }\n return false;\n }\n}\n\nfunction byTopic(comment: Comment, topic: string): boolean {\n return comment.body.startsWith(`### ${topic}\\n\\n`);\n}\n\nfunction byContent(comment: Comment, content: string): boolean {\n return comment.body.trim() === content;\n}\n\nexport async function ensureCommentRemoval(\n deleteConfig: EnsureCommentRemovalConfig,\n): Promise<void> {\n const { number: issueNo } = deleteConfig;\n const key =\n deleteConfig.type === 'by-topic'\n ? deleteConfig.topic\n : deleteConfig.content;\n logger.trace(`Ensuring comment \"${key}\" in #${issueNo} is removed`);\n const comments = await getComments(issueNo);\n let commentId: number | null | undefined = null;\n\n // v8 ignore else -- TODO: add test #40625\n if (deleteConfig.type === 'by-topic') {\n const topic = deleteConfig.topic;\n commentId = comments.find((comment) => byTopic(comment, topic))?.id;\n } else if (deleteConfig.type === 'by-content') {\n const content = deleteConfig.content;\n commentId = comments.find((comment) => byContent(comment, content))?.id;\n }\n\n try {\n // v8 ignore else -- TODO: add test #40625\n if (commentId) {\n logger.debug(`Removing comment from issueNo: ${issueNo}`);\n await deleteComment(commentId);\n }\n } catch (err) /* v8 ignore next -- defensive: comment deletion failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Error deleting comment');\n }\n}\n\n// Pull Request\n\nasync function tryPrAutomerge(\n prNumber: number,\n prNodeId: string,\n platformPrOptions: PlatformPrOptions | undefined,\n): Promise<void> {\n if (!platformPrOptions?.usePlatformAutomerge) {\n return;\n }\n\n // If GitHub Enterprise Server <3.3.0 it doesn't support automerge\n // TODO #22198\n // semver not null safe, accepts null and undefined\n if (\n platformConfig.isGhe &&\n semver.satisfies(platformConfig.gheVersion!, '<3.3.0')\n ) {\n logger.debug(\n { prNumber },\n 'GitHub-native automerge: not supported on this version of GHE. Use 3.3.0 or newer.',\n );\n return;\n }\n\n if (!config.autoMergeAllowed) {\n logger.debug(\n { prNumber },\n 'GitHub-native automerge: not enabled in repo settings',\n );\n return;\n }\n\n try {\n const mergeMethod = config.mergeMethod?.toUpperCase() || 'MERGE';\n\n let commitHeadline: string | undefined;\n let commitBody: string | undefined;\n // For SQUASH and MERGE methods, pass the commit message explicitly to avoid\n // GitHub using the PR description as the commit body when \"Use PR title and\n // body as commit message\" is enabled in repository settings.\n const automergeCommitMessage = platformPrOptions?.automergeCommitMessage;\n if (mergeMethod !== 'REBASE' && automergeCommitMessage) {\n const newlineIndex = automergeCommitMessage.indexOf('\\n');\n if (newlineIndex === -1) {\n commitHeadline = automergeCommitMessage;\n } else {\n commitHeadline = automergeCommitMessage.slice(0, newlineIndex);\n commitBody = automergeCommitMessage.slice(newlineIndex + 1).trim();\n }\n\n // Add PR number to the commit headline to match the default GitHub behavior\n commitHeadline = `${commitHeadline} (#${prNumber})`;\n }\n\n const variables = {\n pullRequestId: prNodeId,\n mergeMethod,\n commitHeadline,\n commitBody,\n };\n // set count to one bypass graphql check\n const queryOptions = { variables, count: 1 };\n\n const res = await githubApi.requestGraphql<GhAutomergeResponse>(\n enableAutoMergeMutation,\n queryOptions,\n );\n\n if (res?.errors) {\n logger.debug(\n { prNumber, errors: res.errors },\n 'GitHub-native automerge: fail',\n );\n return;\n }\n\n logger.debug(`GitHub-native automerge: success...PrNo: ${prNumber}`);\n } catch (err) /* v8 ignore next: missing test #22198 */ {\n logger.warn({ prNumber, err }, 'GitHub-native automerge: REST API error');\n }\n}\n\n// Creates PR and returns PR number\nexport async function createPr({\n sourceBranch,\n targetBranch,\n prTitle: title,\n prBody: rawBody,\n labels,\n draftPR = false,\n platformPrOptions,\n milestone,\n}: CreatePRConfig): Promise<GhPr | null> {\n const body = sanitize(rawBody);\n const base = targetBranch;\n // Include the repository owner to handle forkToken and regular mode\n // TODO: can `repository` be null? (#22198)\n\n const head = `${config.repository!.split('/')[0]}:${sourceBranch}`;\n const options: any = {\n body: {\n title,\n head,\n base,\n body,\n draft: draftPR,\n },\n };\n /* v8 ignore next -- fork mode is not exercised in createPr specs */\n if (config.forkToken) {\n options.token = config.forkToken;\n options.body.maintainer_can_modify =\n !config.forkOrg &&\n platformPrOptions?.forkModeDisallowMaintainerEdits !== true;\n }\n logger.debug({ title, head, base, draft: draftPR }, 'Creating PR');\n const ghPr = (\n await githubApi.postJson<GhRestPr>(\n `repos/${config.parentRepo ?? config.repository}/pulls`,\n options,\n )\n ).body;\n logger.debug(\n { branch: sourceBranch, pr: ghPr.number, draft: draftPR },\n 'PR created',\n );\n\n const result = coerceRestPr(ghPr);\n const { number, node_id } = result;\n\n await addLabels(number, labels);\n await tryAddMilestone(number, milestone);\n await tryPrAutomerge(number, node_id, platformPrOptions);\n\n cachePr(result);\n return result;\n}\n\nasync function isMergeQueueEnabled(baseBranch: string): Promise<boolean> {\n const cachedResult = config.mergeQueueEnabled[baseBranch];\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n\n // TODO #22198\n // semver not null safe, accepts null and undefined\n if (\n platformConfig.isGhe &&\n semver.satisfies(platformConfig.gheVersion!, '<3.12.0')\n ) {\n // Merge queues are only supported on GHES >=3.12.0\n config.mergeQueueEnabled[baseBranch] = false;\n return false;\n }\n\n // Assume enabled unless proven otherwise, so the merge queue check is not\n // skipped by mistake\n let result = true;\n try {\n const res = await githubApi.requestGraphql<{\n repository: { mergeQueue: { id: string } | null };\n }>(repoMergeQueueQuery, {\n variables: {\n owner: config.repositoryOwner,\n name: config.repositoryName,\n branch: baseBranch,\n },\n readOnly: true,\n count: 1, // bypass graphql check\n });\n if (res?.errors) {\n logger.debug(\n { baseBranch, errors: res.errors },\n 'Failed to fetch merge queue status - assuming merge queue is enabled',\n );\n } else {\n result = isNonEmptyObject(res?.data?.repository?.mergeQueue);\n }\n } catch (err) {\n logger.debug(\n { baseBranch, err },\n 'Error fetching merge queue status - assuming merge queue is enabled',\n );\n }\n\n config.mergeQueueEnabled[baseBranch] = result;\n return result;\n}\n\nexport async function assertPrNotInMergeQueue(\n branchName: string,\n baseBranch?: string,\n): Promise<void> {\n if (!(await isMergeQueueEnabled(baseBranch ?? config.defaultBranch))) {\n return;\n }\n\n const pr = await findPr({ branchName, state: 'open' });\n if (!pr) {\n return;\n }\n\n if (\n await isPrInMergeQueue(\n githubApi,\n config.repositoryOwner,\n config.repositoryName,\n pr.number,\n )\n ) {\n logger.debug(`PR #${pr.number} is in the merge queue - aborting push`);\n throw new Error(PR_ALREADY_IN_MERGE_QUEUE);\n }\n}\n\nexport async function updatePr({\n number: prNo,\n prTitle: title,\n prBody: rawBody,\n addLabels: labelsToAdd,\n removeLabels,\n state,\n targetBranch,\n}: UpdatePrConfig): Promise<void> {\n logger.debug(`updatePr(${prNo}, ${title}, body)`);\n const body = sanitize(rawBody);\n const patchBody: any = { title };\n // v8 ignore else -- TODO: add test #40625\n if (body) {\n patchBody.body = body;\n }\n if (targetBranch) {\n patchBody.base = targetBranch;\n }\n if (state) {\n patchBody.state = state;\n }\n const options: any = {\n body: patchBody,\n };\n /* v8 ignore next -- fork mode is not exercised in updatePr specs */\n if (config.forkToken) {\n options.token = config.forkToken;\n }\n\n // Update PR labels\n try {\n if (labelsToAdd) {\n await addLabels(prNo, labelsToAdd);\n }\n\n if (removeLabels) {\n for (const label of removeLabels) {\n await deleteLabel(prNo, label);\n }\n }\n\n const { body: ghPr } = await githubApi.patchJson<GhRestPr>(\n `repos/${config.parentRepo ?? config.repository}/pulls/${prNo}`,\n options,\n );\n const result = coerceRestPr(ghPr);\n cachePr(result);\n logger.debug(`PR updated...prNo: ${prNo}`);\n } catch (err) /* v8 ignore next -- non-host update failures are logged and swallowed, not mocked in specs */ {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n logger.warn({ err }, 'Error updating PR');\n }\n}\n\nexport async function reattemptPlatformAutomerge({\n number,\n platformPrOptions,\n}: ReattemptPlatformAutomergeConfig): Promise<void> {\n try {\n const result = (await getPr(number))!;\n const { node_id } = result;\n\n await tryPrAutomerge(number, node_id, platformPrOptions);\n\n logger.debug(`PR platform automerge re-attempted...prNo: ${number}`);\n } catch (err) /* v8 ignore next -- defensive: automerge re-attempt failures are logged and swallowed, not simulated in specs */ {\n logger.warn({ err }, 'Error re-attempting PR platform automerge');\n }\n}\n\nexport async function mergePr({\n branchName,\n id: prNo,\n strategy,\n}: MergePRConfig): Promise<boolean> {\n logger.debug(`mergePr(${prNo}, ${branchName})`);\n const url = `repos/${\n config.parentRepo ?? config.repository\n }/pulls/${prNo}/merge`;\n const options: GithubHttpOptions = {\n body: {},\n };\n /* v8 ignore next -- fork mode is not exercised in mergePr specs */\n if (config.forkToken) {\n options.token = config.forkToken;\n }\n let automerged = false;\n let automergeResult: HttpResponse<unknown>;\n const mergeStrategy = mapMergeStartegy(strategy) ?? config.mergeMethod;\n\n // v8 ignore else -- TODO: add test #40625\n if (mergeStrategy) {\n // This path is taken if we have auto-detected the allowed merge types from the repo or\n // automergeStrategy is configured by user\n options.body.merge_method = mergeStrategy;\n try {\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n automerged = true;\n } catch (err) /* v8 ignore next -- merge rejection handling (404/405 status-check bodies) is not fully mocked in specs */ {\n if (err.statusCode === 404 || err.statusCode === 405) {\n const body = err.response?.body;\n if (\n isNonEmptyString(body?.message) &&\n regEx(/^Required status check \".+\" is expected\\.$/).test(body.message)\n ) {\n logger.debug(\n { response: body },\n `GitHub blocking PR merge -- Missing required status check(s)`,\n );\n return false;\n }\n if (\n isNonEmptyString(body?.message) &&\n (body.message.includes('approving review') ||\n body.message.includes('code owner review') ||\n body.message.includes(\n 'New changes require approval from someone other than the last pusher',\n ))\n ) {\n logger.debug(\n { response: body },\n `GitHub blocking PR merge -- Needs approving review(s)`,\n );\n return false;\n }\n logger.debug(\n { response: body },\n 'GitHub blocking PR merge -- will keep trying',\n );\n } else {\n logger.warn(\n { mergeMethod: config.mergeMethod, err },\n 'Failed to merge PR',\n );\n return false;\n }\n }\n }\n if (!automerged) {\n // We need to guess the merge method and try squash -> merge -> rebase\n options.body.merge_method = 'squash';\n try {\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n } catch (err1) {\n logger.debug({ err: err1 }, `Failed to squash merge PR`);\n try {\n options.body.merge_method = 'merge';\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n } catch (err2) {\n logger.debug({ err: err2 }, `Failed to merge commit PR`);\n try {\n options.body.merge_method = 'rebase';\n logger.debug({ options, url }, `mergePr`);\n automergeResult = await githubApi.putJson(url, options);\n } catch (err3) {\n logger.debug({ err: err3 }, `Failed to rebase merge PR`);\n logger.info({ pr: prNo }, 'All merge attempts failed');\n return false;\n }\n }\n }\n }\n logger.debug(\n { automergeResult: automergeResult!.body, pr: prNo },\n 'PR merged',\n );\n const cachedPr = config.prList?.find(({ number }) => number === prNo);\n if (cachedPr) {\n cachePr({ ...cachedPr, state: 'merged' });\n }\n return true;\n}\n\nexport function massageMarkdown(input: string): string {\n if (platformConfig.isGhe) {\n return smartTruncate(input, maxBodyLength());\n }\n const massagedInput = massageMarkdownLinks(input)\n // to be safe, replace all github.com links with redirect.github.com\n .replace(\n regEx(/href=\"https?:\\/\\/github.com\\//g),\n 'href=\"https://redirect.github.com/',\n )\n .replace(\n regEx(/]\\(https:\\/\\/github\\.com\\//g),\n '](https://redirect.github.com/',\n )\n .replace(\n regEx(/]: https:\\/\\/github\\.com\\//g),\n ']: https://redirect.github.com/',\n )\n .replaceAll('> ℹ **Note**\\n> \\n', '> [!NOTE]\\n')\n .replaceAll('> ℹ️ **Note**\\n> \\n', '> [!NOTE]\\n')\n .replaceAll('> ⚠ **Warning**\\n> \\n', '> [!WARNING]\\n')\n .replaceAll('> ⚠️ **Warning**\\n> \\n', '> [!WARNING]\\n')\n .replaceAll('> ❗ **Caution**\\n> \\n', '> [!CAUTION]\\n')\n .replaceAll('> ❗ **Important**\\n> \\n', '> [!IMPORTANT]\\n');\n return smartTruncate(massagedInput, maxBodyLength());\n}\n\nexport function maxBodyLength(): number {\n return GitHubMaxPrBodyLen;\n}\n\nexport async function getVulnerabilityAlerts(): Promise<GithubVulnerabilityAlerts> {\n /* v8 ignore next -- specs initialize repos with vulnerability alerts enabled */\n if (config.hasVulnerabilityAlertsEnabled === false) {\n logger.debug('No vulnerability alerts enabled for repo');\n return [];\n }\n let vulnerabilityAlerts: GithubVulnerabilityAlerts | undefined;\n try {\n vulnerabilityAlerts = (\n await githubApi.getJson(\n `/repos/${config.repositoryOwner}/${config.repositoryName}/dependabot/alerts?state=open&direction=asc&per_page=100`,\n {\n paginate: true,\n headers: { accept: 'application/vnd.github+json' },\n cacheProvider: repoCacheProvider,\n },\n GithubVulnerabilityAlerts,\n )\n ).body;\n } catch (err) /* v8 ignore next -- alert-permission failures are logged and swallowed, not mocked in specs */ {\n logger.debug({ err }, 'Error retrieving vulnerability alerts');\n logger.warn(\n {\n url: `${GlobalConfig.get('productLinks').documentation}configuration-options/#vulnerabilityalerts`,\n },\n 'Cannot access vulnerability alerts. Please ensure permissions have been granted.',\n );\n }\n try {\n if (vulnerabilityAlerts?.length) {\n const shortAlerts: AggregatedVulnerabilities = {};\n logger.trace(\n { alerts: vulnerabilityAlerts },\n 'GitHub vulnerability details',\n );\n for (const alert of vulnerabilityAlerts) {\n // v8 ignore if -- TODO: can never happen but makes typescript happy #40625\n if (alert.security_vulnerability === null) {\n // As described in the documentation, there are cases in which\n // GitHub API responds with `\"securityVulnerability\": null`.\n // But it's may be faulty, so skip processing it here.\n continue;\n }\n const {\n package: { name, ecosystem },\n vulnerable_version_range: vulnerableVersionRange,\n first_patched_version: firstPatchedVersion,\n } = alert.security_vulnerability;\n const patch = firstPatchedVersion?.identifier;\n\n const normalizedName =\n ecosystem === 'pip' ? normalizePythonDepName(name) : name;\n alert.security_vulnerability.package.name = normalizedName;\n const key = `${ecosystem.toLowerCase()}/${normalizedName}`;\n const range = vulnerableVersionRange;\n const elem = shortAlerts[key] || {};\n elem[range] = coerceToNull(patch);\n shortAlerts[key] = elem;\n }\n logger.debug({ alerts: shortAlerts }, 'GitHub vulnerability details');\n } else {\n logger.debug('No vulnerability alerts found');\n }\n } catch (err) /* v8 ignore next -- defensive: processing already-parsed alerts does not throw in specs */ {\n logger.error({ err }, 'Error processing vulnerabity alerts');\n }\n return vulnerabilityAlerts ?? [];\n}\n\nasync function pushFiles(\n { branchName, message, trailers }: CommitFilesConfig,\n { parentCommitSha, commitSha }: CommitResult,\n): Promise<LongCommitSha | null> {\n try {\n // Hybrid git/REST commit strategy (see #13824, #14271):\n // 1. The git push below uploads blobs to GitHub via a custom ref\n // (refs/renovate/branches/*) which does NOT trigger CI/Actions.\n // 2. We then recreate the tree+commit via REST API so that:\n // - The commit is signed by GitHub (\"committed via GitHub\" badge)\n // - Force-push and file mode bits are supported (GraphQL can't do this)\n // - We can use base_tree to send only changed files, avoiding org\n // ruleset file-path restrictions on unchanged files (#42554)\n // Reusing the pushed commit/tree SHAs directly does not work because\n // the branch ref must point to an API-created commit for signing.\n await pushCommitToRenovateRef(commitSha, branchName);\n const baseTreeSha = await getCommitTreeSha(parentCommitSha);\n const treeItems = await diffCommitTree(parentCommitSha, commitSha);\n\n if (treeItems.length === 0) {\n logger.debug(\n { branchName },\n 'Platform-native commit: no changed files between commits',\n );\n return null;\n }\n\n const treeRes = await githubApi.postJson<{ sha: string }>(\n `/repos/${config.repository}/git/trees`,\n { body: { base_tree: baseTreeSha, tree: treeItems } },\n );\n const treeSha = treeRes.body.sha;\n\n const commitMessage = formatCommitMessage(message, trailers);\n\n // Now we recreate the commit using the tree we recreated the step before\n const commitRes = await githubApi.postJson<{ sha: string }>(\n `/repos/${config.repository}/git/commits`,\n {\n body: {\n message: commitMessage,\n tree: treeSha,\n parents: [parentCommitSha],\n },\n },\n );\n incLimitedValue('Commits');\n const remoteCommitSha = toLongCommitSha(commitRes.body.sha);\n await ensureBranchSha(branchName, remoteCommitSha);\n return remoteCommitSha;\n } catch (err) {\n logger.debug({ branchName, err }, 'Platform-native commit: unknown error');\n return null;\n }\n}\n\nexport async function commitFiles(\n config: CommitFilesConfig,\n): Promise<LongCommitSha | null> {\n const commitResult = await git.prepareCommit(config); // Commit locally and don't push\n const { branchName, files } = config;\n if (!commitResult) {\n logger.debug(\n { branchName, files: files.map(({ path }) => path) },\n `Platform-native commit: unable to prepare for commit`,\n );\n return null;\n }\n // Perform the commits using REST API\n const pushResult = await pushFiles(config, commitResult);\n if (!pushResult) {\n return null;\n }\n // Replace locally created branch with the remotely created one\n // and return the remote commit SHA\n await git.resetToCommit(commitResult.parentComm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AAE,CACtD,EAAA,CACwB,KAAK;EAE7B,MAAM,gBAAgB,oBAAoB,SAAS,QAAQ;EAG3D,MAAM,YAAY,MAAM,UAAU,SAChC,UAAU,OAAO,WAAW,eAC5B,EACE,MAAM;GACJ,SAAS;GACT,MAAM;GACN,SAAS,CAAC,eAAe;EAC3B,EACF,CACF;EACA,gBAAgB,SAAS;EACzB,MAAM,kBAAkB,gBAAgB,UAAU,KAAK,GAAG;EAC1D,MAAM,gBAAgB,YAAY,eAAe;EACjD,OAAO;CACT,SAAS,KAAK;EACZ,OAAO,MAAM;GAAE;GAAY;EAAI,GAAG,uCAAuC;EACzE,OAAO;CACT;AACF;AAEA,eAAsB,YACpB,QAC+B;CAC/B,MAAM,eAAe,MAAMI,cAAkB,MAAM;CACnD,MAAM,EAAE,YAAY,UAAU;CAC9B,IAAI,CAAC,cAAc;EACjB,OAAO,MACL;GAAE;GAAY,OAAO,MAAM,KAAK,EAAE,WAAW,IAAI;EAAE,GACnD,sDACF;EACA,OAAO;CACT;CAGA,IAAI,CAAC,MADoB,UAAU,QAAQ,YAAY,GAErD,OAAO;CAIT,MAAMC,cAAkB,aAAa,eAAe;CAEpD,OAAO,MADiBC,YAAgB,UAAU;AAEpD"}
|
package/package.json
CHANGED
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.32.
|
|
3
|
+
"title": "JSON schema for Renovate 44.32.3 config files (https://renovatebot.com/)",
|
|
4
4
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"x-renovate-version": "44.32.
|
|
5
|
+
"x-renovate-version": "44.32.3",
|
|
6
6
|
"allowComments": true,
|
|
7
7
|
"type": "object",
|
|
8
8
|
"definitions": {
|