renovate 44.84.0 → 44.85.1
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/config/presets/forgejo/index.js +3 -2
- package/dist/config/presets/forgejo/index.js.map +1 -1
- package/dist/config/presets/gitea/index.js +10 -3
- package/dist/config/presets/gitea/index.js.map +1 -1
- package/dist/constants/error-messages.d.ts +3 -2
- package/dist/constants/error-messages.js +3 -1
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/modules/platform/api.js +6 -6
- package/dist/modules/platform/forgejo/index.js +21 -587
- package/dist/modules/platform/forgejo/index.js.map +1 -1
- package/dist/modules/platform/gitea/gitea-helper.js +90 -74
- package/dist/modules/platform/gitea/gitea-helper.js.map +1 -1
- package/dist/modules/platform/gitea/index.js +561 -529
- package/dist/modules/platform/gitea/index.js.map +1 -1
- package/dist/modules/platform/gitea/labels.js +42 -0
- package/dist/modules/platform/gitea/labels.js.map +1 -0
- package/dist/modules/platform/gitea/pr-cache.js +66 -28
- package/dist/modules/platform/gitea/pr-cache.js.map +1 -1
- package/dist/modules/platform/gitea/schema.js +141 -5
- package/dist/modules/platform/gitea/schema.js.map +1 -1
- package/dist/modules/platform/gitea/utils.js +10 -8
- package/dist/modules/platform/gitea/utils.js.map +1 -1
- package/dist/modules/platform/gitlab/index.js +11 -3
- package/dist/modules/platform/gitlab/index.js.map +1 -1
- package/dist/util/cache/repository/types.d.ts +13 -8
- package/dist/util/http/forgejo.js +6 -35
- package/dist/util/http/forgejo.js.map +1 -1
- package/dist/workers/repository/error.js +5 -0
- package/dist/workers/repository/error.js.map +1 -1
- package/dist/workers/repository/process/lookup/index.js +2 -2
- package/dist/workers/repository/process/lookup/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/forgejo/index.js +1 -1
- package/dist/workers/repository/update/pr/changelog/forgejo/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitea/index.js +3 -3
- package/dist/workers/repository/update/pr/changelog/gitea/index.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
- package/dist/modules/platform/forgejo/forgejo-helper.js +0 -235
- package/dist/modules/platform/forgejo/forgejo-helper.js.map +0 -1
- package/dist/modules/platform/forgejo/pr-cache.js +0 -114
- package/dist/modules/platform/forgejo/pr-cache.js.map +0 -1
- package/dist/modules/platform/forgejo/schema.js +0 -149
- package/dist/modules/platform/forgejo/schema.js.map +0 -1
- package/dist/modules/platform/forgejo/utils.js +0 -115
- package/dist/modules/platform/forgejo/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["allVersioning.get"],"sources":["../../../../../lib/workers/repository/process/lookup/index.ts"],"sourcesContent":["import { isNonEmptyString, isString, isUndefined } from '@sindresorhus/is';\nimport { mergeChildConfig } from '../../../../config/index.ts';\nimport type { ValidationMessage } from '../../../../config/types.ts';\nimport { CONFIG_VALIDATION } from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport {\n getDatasourceFor,\n getDefaultVersioning,\n} from '../../../../modules/datasource/common.ts';\nimport type {\n GetDigestInputConfig,\n Release,\n ReleaseResult,\n} from '../../../../modules/datasource/index.ts';\nimport {\n applyDatasourceFilters,\n getDigest,\n getRawPkgReleases,\n isGetPkgReleasesConfig,\n supportsDigests,\n} from '../../../../modules/datasource/index.ts';\nimport { postprocessRelease } from '../../../../modules/datasource/postprocess-release.ts';\nimport { getRangeStrategy } from '../../../../modules/manager/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport { id as dockerVersioningId } from '../../../../modules/versioning/docker/index.ts';\nimport * as allVersioning from '../../../../modules/versioning/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { assignKeys } from '../../../../util/assign-keys.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { checkMinimumReleaseAge } from '../../../../util/minimum-release-age.ts';\nimport { applyPackageRules } from '../../../../util/package-rules/index.ts';\nimport { regEx } from '../../../../util/regex.ts';\nimport { Result } from '../../../../util/result.ts';\nimport type { Timestamp } from '../../../../util/timestamp.ts';\nimport { calculateAbandonment } from './abandonment.ts';\nimport { getBucket } from './bucket.ts';\nimport { getCurrentVersion } from './current.ts';\nimport { filterVersions } from './filter.ts';\nimport { filterInternalChecks } from './filter-checks.ts';\nimport { generateUpdate } from './generate.ts';\nimport { getRollbackUpdate } from './rollback.ts';\nimport { calculateMostRecentTimestamp } from './timestamps.ts';\nimport type { LookupUpdateConfig, UpdateResult } from './types.ts';\nimport {\n addReplacementUpdateIfValid,\n isReplacementRulesConfigured,\n} from './utils.ts';\n\nasync function getTimestamp(\n config: LookupUpdateConfig,\n versions: Release[],\n version: string,\n versioningApi: allVersioning.VersioningApi,\n): Promise<Timestamp | null | undefined> {\n const currentRelease = versions.find(\n (v) =>\n versioningApi.isValid(v.version) &&\n versioningApi.equals(v.version, version),\n );\n\n if (!currentRelease) {\n return null;\n }\n\n if (currentRelease.releaseTimestamp) {\n return currentRelease.releaseTimestamp;\n }\n\n const remoteRelease = await postprocessRelease(config, currentRelease);\n return remoteRelease?.releaseTimestamp;\n}\n\n/** The only two `updateType`s that `applyMinimumReleaseAgeToDigestUpdate()` can be called with */\ntype DigestLikeUpdate = LookupUpdate & { updateType: 'digest' | 'pinDigest' };\n\n/**\n * A helper function to allow a short-circuit for `minimumReleaseAge` functionality if a package may have config that applies it.\n *\n * Allows avoiding unnecessary calls to more expensive checks like merge + `applyPackageRules()` and `getTimestamp()`.\n */\nfunction couldApplyMinimumReleaseAgeToDigest(\n config: LookupUpdateConfig,\n updateType: DigestLikeUpdate['updateType'],\n): boolean {\n // Match filterInternalChecks(): under `none` the user opted out of internal\n // checks entirely, so do no merging, no package rules, no age check and no\n // logging claiming an age check ran.\n if (config.internalChecksFilter === 'none') {\n return false;\n }\n\n return (\n isNonEmptyString(config.minimumReleaseAge) ||\n isNonEmptyString(config[updateType]?.minimumReleaseAge) ||\n !!config.packageRules?.some((rule) =>\n isNonEmptyString(rule.minimumReleaseAge),\n )\n );\n}\n\n/**\n * Ensure `minimumReleaseAge`/`internalChecksFilter` applies to digest/pinDigest updates, as they don't currently get run through `filterInternalChecks()`.\n *\n * NOTE that this should be kept in sync with `filterInternalChecks`()\n */\nasync function applyMinimumReleaseAgeToDigestUpdate(\n update: DigestLikeUpdate,\n config: LookupUpdateConfig,\n res: UpdateResult,\n currentVersionWasResolved: boolean,\n newestMatchingVersionTimestamp: Timestamp | null | undefined,\n): Promise<void> {\n if (!couldApplyMinimumReleaseAgeToDigest(config, update.updateType)) {\n return;\n }\n\n if (update.updateType === 'pinDigest' && !currentVersionWasResolved) {\n // Not `!res.currentVersion` - that's force-set to lockedVersion further down regardless of timestamp resolution.\n // `pinDigest` doesn't repoint anywhere, unlike `digest` - it just freezes whatever the ref already resolves to.\n // An unversioned tag (e.g. `latest`) has no versioned release to age against, and holding the pin would only\n // prolong the less-pinned (less safe) state, so skip the check entirely rather than treating the missing\n // timestamp as pending.\n logger.once.debug(\n { depName: config.depName, updateType: update.updateType },\n `Skipping minimumReleaseAge check for ${update.updateType} update of ${config.depName}, as its current value does not resolve to a versioned release`,\n );\n return;\n }\n\n let releaseConfig: LookupUpdateConfig = {\n ...mergeChildConfig(config, res),\n updateType: update.updateType,\n };\n releaseConfig = mergeChildConfig(\n releaseConfig,\n releaseConfig[update.updateType]!,\n );\n releaseConfig = await applyPackageRules(releaseConfig, 'update-type');\n\n // Not update.releaseTimestamp - that field means \"age of the new release\" elsewhere (generate.ts, libyear.ts).\n // Not res.currentVersionTimestamp either - that tracks whatever rangeStrategy resolves currentVersion to (e.g.\n // the oldest matching release under `bump`), whereas both `digest` and `pinDigest` reflect whatever the current\n // value's ref actually resolves to *right now*, which is always the newest matching version.\n const ageCheck = checkMinimumReleaseAge(\n releaseConfig,\n newestMatchingVersionTimestamp,\n );\n\n // Mirror filterInternalChecks()'s logging so a held/passed digest update is diagnosable.\n if (ageCheck.minimumReleaseAgeMs && !ageCheck.hasTimestamp) {\n if (releaseConfig.minimumReleaseAgeBehaviour === 'timestamp-optional') {\n logger.once.warn(\n \"Some release(s) did not have a releaseTimestamp, but as we're running with minimumReleaseAgeBehaviour=timestamp-optional, proceeding. See debug logs for more information\",\n );\n }\n\n logger.once.debug(\n {\n depName: config.depName,\n updateType: update.updateType,\n minimumReleaseAgeBehaviour: releaseConfig.minimumReleaseAgeBehaviour,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update of ${config.depName} has no releaseTimestamp to age against`,\n );\n }\n if (ageCheck.isPending) {\n logger.trace(\n {\n depName: config.depName,\n updateType: update.updateType,\n releaseTimestamp: newestMatchingVersionTimestamp,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update is pending minimumReleaseAge status checks`,\n );\n\n // internalChecksFilter is read from the unmerged top-level config, like filterInternalChecks().\n if (config.internalChecksFilter === 'strict') {\n update.pendingChecks = true;\n }\n }\n}\n\nexport async function lookupUpdates(\n inconfig: LookupUpdateConfig,\n): Promise<Result<UpdateResult>> {\n let config: LookupUpdateConfig = { ...inconfig };\n config.versioning ??= getDefaultVersioning(config.datasource);\n\n const versioningApi = allVersioning.get(config.versioning);\n\n let dependency: ReleaseResult | null = null;\n const res: UpdateResult = {\n versioning: config.versioning,\n updates: [],\n warnings: [],\n };\n // Timestamp of the release a `digest`/`pinDigest` update's current value currently resolves to (the newest version matching it, regardless of `rangeStrategy`), as opposed to `res.currentVersionTimestamp` which tracks whatever the configured rangeStrategy resolves `currentVersion` to (e.g. the oldest for `bump`)\n let newestMatchingVersionTimestamp: Timestamp | null | undefined;\n // The `digest` update for `config.currentDigest` (if one is added), so its age check can run after `newDigest` is fetched and no-op updates are stripped.\n let digestUpdate: DigestLikeUpdate | undefined;\n\n try {\n logger.trace(\n {\n dependency: config.packageName,\n currentValue: config.currentValue,\n },\n 'lookupUpdates',\n );\n if (config.currentValue && !isString(config.currentValue)) {\n // If currentValue is not a string, then it's invalid\n // v8 ignore else -- TODO: add test #40625\n if (config.currentValue) {\n logger.debug(\n `Invalid currentValue for ${config.packageName}: ${JSON.stringify(config.currentValue)} (${typeof config.currentValue})`,\n );\n }\n res.skipReason = 'invalid-value';\n return Result.ok(res);\n }\n if (\n !isGetPkgReleasesConfig(config) ||\n !getDatasourceFor(config.datasource)\n ) {\n res.skipReason = 'invalid-config';\n return Result.ok(res);\n }\n let compareValue = config.currentValue;\n if (\n isString(config.currentValue) &&\n isString(config.versionCompatibility)\n ) {\n const versionCompatbilityRegEx = regEx(config.versionCompatibility);\n const regexMatch = versionCompatbilityRegEx.exec(config.currentValue);\n if (regexMatch?.groups) {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n groups: regexMatch.groups,\n },\n 'version compatibility regex match',\n );\n config.currentCompatibility = regexMatch.groups.compatibility;\n res.currentCompatibility = regexMatch.groups.compatibility;\n compareValue = regexMatch.groups.version;\n } else {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n },\n 'version compatibility regex mismatch',\n );\n }\n }\n\n const isValid =\n isString(compareValue) && versioningApi.isValid(compareValue);\n\n const unconstrainedValue =\n !!config.lockedVersion && isUndefined(config.currentValue);\n\n if (isValid || unconstrainedValue) {\n if (\n !config.updatePinnedDependencies &&\n // TODO #22198\n versioningApi.isSingleVersion(compareValue!)\n ) {\n res.skipReason = 'is-pinned';\n return Result.ok(res);\n }\n\n const { val: releaseResult, err: lookupError } = await getRawPkgReleases(\n config,\n )\n .transform((res) => calculateMostRecentTimestamp(versioningApi, res))\n .transform((res) => calculateAbandonment(res, config))\n .transform((res) => applyDatasourceFilters(res, config))\n .unwrap();\n\n if (lookupError instanceof Error) {\n throw lookupError;\n }\n\n if (lookupError) {\n // If dependency lookup fails then warn and return\n const warning: ValidationMessage = {\n topic: config.packageName,\n message: `Failed to look up ${config.datasource} package ${config.packageName}: ${lookupError}`,\n };\n logger.debug(\n {\n dependency: config.packageName,\n packageFile: config.packageFile,\n },\n warning.message,\n );\n // TODO: return warnings in own field\n res.warnings.push(warning);\n return Result.ok(res);\n }\n\n dependency = releaseResult;\n\n if (dependency.deprecationMessage) {\n logger.debug(\n `Found deprecationMessage for ${config.datasource} package ${config.packageName}`,\n );\n }\n\n assignKeys(res, dependency, [\n 'deprecationMessage',\n 'sourceUrl',\n 'registryUrl',\n 'sourceDirectory',\n 'homepage',\n 'changelogUrl',\n 'dependencyUrl',\n 'lookupName',\n 'packageScope',\n 'mostRecentTimestamp',\n 'isAbandoned',\n 'respectLatest',\n ]);\n\n const latestVersion = dependency.tags?.latest;\n // Filter out any results from datasource that don't comply with our versioning\n let allVersions = dependency.releases.filter((release) =>\n versioningApi.isVersion(release.version),\n );\n const allReleaseVersions = new Set(allVersions.map((r) => r.version));\n // istanbul ignore if\n if (allVersions.length === 0) {\n const message = `Found no results from datasource that look like a version`;\n logger.info(\n {\n dependency: config.packageName,\n result: dependency,\n },\n message,\n );\n if (!config.currentDigest) {\n return Result.ok(res);\n }\n }\n // Reapply package rules in case we missed something from sourceUrl\n config = await applyPackageRules(\n { ...config, sourceUrl: res.sourceUrl },\n 'source-url',\n );\n if (config.followTag) {\n const taggedVersion = dependency.tags?.[config.followTag];\n if (!taggedVersion) {\n res.warnings.push({\n topic: config.packageName,\n message: `Can't find version with tag ${config.followTag} for ${config.datasource} package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n allVersions = allVersions.filter(\n (v) =>\n v.version === taggedVersion ||\n (v.version === compareValue &&\n versioningApi.isGreaterThan(taggedVersion, compareValue)),\n );\n }\n\n const inRangeOnlyStrategy = config.rangeStrategy === 'in-range-only';\n // Check that existing constraint can be satisfied\n const allSatisfyingVersions =\n (inRangeOnlyStrategy || config.rollbackPrs) && !unconstrainedValue\n ? allVersions.filter((v) =>\n // TODO #22198\n versioningApi.matches(v.version, compareValue!),\n )\n : allVersions;\n if (!allSatisfyingVersions.length) {\n logger.debug(\n `Found no satisfying versions with '${config.versioning}' versioning`,\n );\n }\n\n if (config.rollbackPrs && !allSatisfyingVersions.length) {\n const rollback = getRollbackUpdate(config, allVersions, versioningApi);\n // istanbul ignore if\n if (!rollback) {\n res.warnings.push({\n topic: config.packageName,\n // TODO: types (#22198)\n message: `Can't find version matching ${compareValue!} for ${\n config.datasource\n } package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n res.updates.push(rollback);\n }\n let rangeStrategy = getRangeStrategy(config);\n\n // istanbul ignore next\n if (\n config.isVulnerabilityAlert &&\n rangeStrategy === 'update-lockfile' &&\n !config.lockedVersion\n ) {\n rangeStrategy = 'bump';\n }\n // unconstrained deps with lockedVersion\n if (\n config.isVulnerabilityAlert &&\n !config.currentValue &&\n config.lockedVersion\n ) {\n rangeStrategy = 'update-lockfile';\n }\n const nonDeprecatedVersions = dependency.releases\n .filter((release) => !release.isDeprecated)\n .map((release) => release.version);\n let currentVersion: string;\n if (rangeStrategy === 'update-lockfile') {\n currentVersion = config.lockedVersion!;\n } else if (\n compareValue &&\n versioningApi.isSingleVersion(compareValue) &&\n allVersions.find((v) => v.version === compareValue)\n ) {\n currentVersion = compareValue;\n }\n // TODO #22198\n currentVersion ??=\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n nonDeprecatedVersions,\n ) ??\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n allVersions.map((v) => v.version),\n )!;\n\n if (!currentVersion) {\n // v8 ignore else -- TODO: add test #40625\n if (!config.lockedVersion) {\n logger.debug(\n `No currentVersion or lockedVersion found for ${config.packageName}`,\n );\n res.skipReason = 'invalid-value';\n }\n return Result.ok(res);\n }\n\n res.currentVersion = currentVersion;\n\n // Use lockedVersion for the timestamp lookup when available, because\n // res.currentVersion is later overwritten to lockedVersion (see below).\n // Without this, strategies like \"replace\" would compute the timestamp\n // for the highest satisfying version (e.g. 1.4.1) while the reported\n // currentVersion ends up being the locked one (e.g. 1.0.0).\n const versionForTimestamp = config.lockedVersion ?? currentVersion;\n const currentVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n versionForTimestamp,\n versioningApi,\n );\n\n if (isNonEmptyString(currentVersionTimestamp)) {\n res.currentVersionTimestamp = currentVersionTimestamp;\n res.currentVersionAgeInDays = getElapsedDays(currentVersionTimestamp);\n\n if (\n config.packageRules?.some((rule) =>\n isNonEmptyString(rule.matchCurrentAge),\n )\n ) {\n // Reapply package rules to check matches for matchCurrentAge\n config = await applyPackageRules(\n { ...config, currentVersionTimestamp },\n 'current-timestamp',\n );\n }\n }\n\n if (\n config.currentDigest\n ? couldApplyMinimumReleaseAgeToDigest(config, 'digest')\n : config.pinDigests &&\n couldApplyMinimumReleaseAgeToDigest(config, 'pinDigest')\n ) {\n // Resolve from `allVersions` (not `dependency.releases`) so that filters like followTag apply, preferring non-deprecated versions with a fallback - both like the `currentVersion` resolution above.\n const newestMatchingVersion =\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.filter((v) => !v.isDeprecated).map((v) => v.version),\n ) ??\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.map((v) => v.version),\n );\n if (newestMatchingVersion) {\n newestMatchingVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n newestMatchingVersion,\n versioningApi,\n );\n }\n }\n\n if (\n compareValue &&\n currentVersion &&\n rangeStrategy === 'pin' &&\n !versioningApi.isSingleVersion(compareValue)\n ) {\n const newValue =\n versioningApi.getPinnedValue?.(currentVersion) ?? currentVersion;\n res.updates.push({\n updateType: 'pin',\n isPin: true,\n newValue,\n newVersion: currentVersion,\n newMajor: versioningApi.getMajor(currentVersion)!,\n });\n }\n if (rangeStrategy === 'pin') {\n // Fall back to replace once pinning logic is done\n rangeStrategy = 'replace';\n }\n // istanbul ignore if\n if (!versioningApi.isVersion(currentVersion!)) {\n res.skipReason = 'invalid-version';\n return Result.ok(res);\n }\n // Filter latest, unstable, etc\n // TODO #22198\n let filteredReleases = filterVersions(\n config,\n currentVersion!,\n latestVersion!,\n inRangeOnlyStrategy ? allSatisfyingVersions : allVersions,\n versioningApi,\n ).filter(\n (v) =>\n // Leave only compatible versions\n unconstrainedValue ||\n versioningApi.isCompatible(v.version, compareValue),\n );\n let shrinkedViaVulnerability = false;\n if (config.isVulnerabilityAlert) {\n if (config.vulnerabilityFixVersion) {\n res.vulnerabilityFixVersion = config.vulnerabilityFixVersion;\n res.vulnerabilityFixStrategy = config.vulnerabilityFixStrategy;\n if (versioningApi.isValid(config.vulnerabilityFixVersion)) {\n let fixedFilteredReleases;\n if (versioningApi.isVersion(config.vulnerabilityFixVersion)) {\n // Retain only releases greater than or equal to the fix version\n fixedFilteredReleases = filteredReleases.filter(\n (release) =>\n !versioningApi.isGreaterThan(\n config.vulnerabilityFixVersion!,\n release.version,\n ),\n );\n } else {\n // Retain only releases which max the fix constraint\n fixedFilteredReleases = filteredReleases.filter((release) =>\n versioningApi.matches(\n release.version,\n config.vulnerabilityFixVersion!,\n ),\n );\n }\n // Warn if this filtering results caused zero releases\n if (fixedFilteredReleases.length === 0 && filteredReleases.length) {\n logger.warn(\n {\n releases: filteredReleases,\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'No releases satisfy vulnerabilityFixVersion',\n );\n }\n // Use the additionally filtered releases\n filteredReleases = fixedFilteredReleases;\n } else {\n logger.warn(\n {\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'vulnerabilityFixVersion is not valid',\n );\n }\n }\n if (config.vulnerabilityFixStrategy === 'highest') {\n // Don't shrink the list of releases - let Renovate use its normal logic\n logger.once.debug(\n `Using vulnerabilityFixStrategy=highest for ${config.packageName}`,\n );\n } else {\n // Shrink the list of releases to the lowest fixed version\n logger.once.debug(\n `Using vulnerabilityFixStrategy=lowest for ${config.packageName}`,\n );\n filteredReleases = filteredReleases.slice(0, 1);\n shrinkedViaVulnerability = true;\n }\n }\n const buckets: Record<string, [Release]> = {};\n for (const release of filteredReleases) {\n const bucket = getBucket(\n config,\n // TODO #22198\n currentVersion!,\n release.version,\n versioningApi,\n );\n // v8 ignore else -- TODO: add test #40625\n if (isString(bucket)) {\n if (buckets[bucket]) {\n buckets[bucket].push(release);\n } else {\n buckets[bucket] = [release];\n }\n }\n }\n const depResultConfig = mergeChildConfig(config, res);\n for (const [bucket, releases] of Object.entries(buckets)) {\n const sortedReleases = releases.sort((r1, r2) =>\n versioningApi.sortVersions(r1.version, r2.version),\n );\n const { release, pendingChecks, pendingReleases } =\n await filterInternalChecks(\n depResultConfig,\n versioningApi,\n bucket,\n sortedReleases,\n );\n // istanbul ignore next\n if (!release) {\n return Result.ok(res);\n }\n const newVersion = release.version;\n const update = await generateUpdate(\n config,\n compareValue,\n versioningApi,\n // TODO #22198\n\n rangeStrategy!,\n config.lockedVersion ?? currentVersion!,\n bucket,\n release,\n allReleaseVersions,\n );\n\n // #29034\n if (\n config.manager === 'gomod' &&\n compareValue?.startsWith('v0.0.0-') &&\n update.newValue?.startsWith('v0.0.0-') &&\n config.currentDigest !== update.newDigest\n ) {\n update.updateType = 'digest';\n\n // As this has already been processed by `filterInternalChecks()`, but we're changing the `updateType`, we need to apply the digest-scoped minimumReleaseAge rules.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `update.updateType` never is here - true is a safe constant.\n await applyMinimumReleaseAgeToDigestUpdate(\n update as DigestLikeUpdate,\n config,\n res,\n true,\n release.releaseTimestamp,\n );\n }\n\n if (pendingChecks) {\n update.pendingChecks = pendingChecks;\n }\n\n if (pendingReleases.length) {\n update.pendingVersions = pendingReleases.map((r) => r.version);\n }\n if (!update.newValue || update.newValue === compareValue) {\n if (!config.lockedVersion) {\n continue;\n }\n // istanbul ignore if\n if (rangeStrategy === 'bump') {\n logger.trace(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n lockedVersion: config.lockedVersion,\n newVersion,\n },\n 'Skipping bump because newValue is the same',\n );\n continue;\n }\n res.isSingleVersion = true;\n }\n res.isSingleVersion ??=\n isString(update.newValue) &&\n versioningApi.isSingleVersion(update.newValue);\n // istanbul ignore if\n if (\n config.versioning === dockerVersioningId &&\n update.updateType !== 'rollback' &&\n update.newValue &&\n versioningApi.isVersion(update.newValue) &&\n compareValue &&\n versioningApi.isVersion(compareValue) &&\n versioningApi.isGreaterThan(compareValue, update.newValue)\n ) {\n logger.warn(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n compareValue,\n currentVersion: config.currentVersion,\n update,\n allVersionsLength: allVersions.length,\n filteredReleaseVersions: filteredReleases.map((r) => r.version),\n shrinkedViaVulnerability,\n },\n 'Unexpected downgrade detected: skipping',\n );\n } else {\n res.updates.push(update);\n }\n }\n } else if (compareValue) {\n logger.debug(\n `Dependency ${config.packageName} has unsupported/unversioned value ${compareValue} (versioning=${config.versioning})`,\n );\n\n if (!config.pinDigests && !config.currentDigest) {\n logger.debug(\n `Skipping ${config.packageName} because no currentDigest or pinDigests`,\n );\n res.skipReason = 'invalid-value';\n } else {\n delete res.skipReason;\n }\n } else {\n res.skipReason = 'invalid-value';\n }\n\n if (isReplacementRulesConfigured(config)) {\n addReplacementUpdateIfValid(res.updates, config);\n } else if (dependency?.replacementName && dependency.replacementVersion) {\n res.updates.push({\n updateType: 'replacement',\n newName: dependency.replacementName,\n newValue: dependency.replacementVersion,\n });\n }\n\n // Record if the dep is fixed to a version\n if (config.lockedVersion) {\n res.currentVersion = config.lockedVersion;\n res.fixedVersion = config.lockedVersion;\n } else if (compareValue && versioningApi.isSingleVersion(compareValue)) {\n res.fixedVersion = compareValue.replace(regEx(/^=+/), '');\n }\n\n // massage versionCompatibility\n if (\n isString(config.currentValue) &&\n isString(compareValue) &&\n isString(config.versionCompatibility)\n ) {\n for (const update of res.updates) {\n logger.debug({ update });\n // v8 ignore else -- TODO: add test #40625\n if (isString(config.currentValue) && isString(update.newValue)) {\n update.newValue = config.currentValue.replace(\n compareValue,\n update.newValue,\n );\n }\n }\n }\n\n // Add digests if necessary\n if (supportsDigests(config.datasource)) {\n if (config.currentDigest) {\n if (!config.digestOneAndOnly || !res.updates.length) {\n // digest update - age-checked after the strip below, once newDigest is known\n digestUpdate = {\n updateType: 'digest',\n newValue: config.currentValue,\n };\n res.updates.push(digestUpdate);\n }\n } else if (\n config.pinDigests &&\n // only update the digest in the package file if it's managed by us\n !config.digestManagedExternally &&\n // Create a pin only if one doesn't already exists\n // v8 ignore else -- TODO: add test #40625\n !res.updates.some((update) => update.updateType === 'pin')\n ) {\n // pin digest\n const pinDigestUpdate: DigestLikeUpdate = {\n isPinDigest: true,\n updateType: 'pinDigest',\n newValue: config.currentValue,\n };\n await applyMinimumReleaseAgeToDigestUpdate(\n pinDigestUpdate,\n config,\n res,\n isValid || unconstrainedValue,\n newestMatchingVersionTimestamp,\n );\n res.updates.push(pinDigestUpdate);\n }\n if (versioningApi.valueToVersion) {\n // TODO #22198\n res.currentVersion = versioningApi.valueToVersion(res.currentVersion!);\n for (const update of res.updates) {\n // TODO #22198\n update.newVersion = versioningApi.valueToVersion(update.newVersion!);\n }\n }\n if (res.registryUrl) {\n config.registryUrls = [res.registryUrl];\n }\n\n // update digest for all\n for (const update of res.updates) {\n // only update the digest in the package file if it's managed by us\n if (\n (config.pinDigests === true && !config.digestManagedExternally) ||\n config.currentDigest\n ) {\n const getDigestConfig: GetDigestInputConfig = {\n ...config,\n registryUrl: update.registryUrl ?? res.registryUrl,\n lookupName: res.lookupName,\n };\n\n // #20304 only pass it for replacement updates, otherwise we get wrong or invalid digest\n if (update.updateType !== 'replacement') {\n delete getDigestConfig.replacementName;\n }\n\n // #20304 don't use lookupName and currentDigest when we replace image name\n if (\n update.updateType === 'replacement' &&\n update.newName !== config.packageName\n ) {\n delete getDigestConfig.lookupName;\n delete getDigestConfig.currentDigest;\n getDigestConfig.replacementName = update.newName;\n }\n\n // Don't use current releases if replacement changes name, otherwise we use the wrong new digest.\n // This happens on datasources which return the digest in release info like `github-tags`.\n // We can still use it when only version is changing.\n if (\n update.updateType !== 'replacement' ||\n update.newName === config.packageName\n ) {\n update.newDigest ??= dependency?.releases.find(\n (r) => r.version === update.newValue,\n )?.newDigest;\n }\n\n update.newDigest ??= await getDigest(\n getDigestConfig,\n update.newValue,\n );\n\n // If the digest could not be determined, report this as otherwise the\n // update will be omitted later on without notice.\n if (update.newDigest === null) {\n logger.debug(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n datasource: config.datasource,\n newValue: update.newValue,\n bucket: update.bucket,\n },\n 'Could not determine new digest for update.',\n );\n\n // Only report a warning if there is a current digest.\n // Context: https://github.com/renovatebot/renovate/pull/20175#discussion_r1102615059.\n if (config.currentDigest) {\n res.warnings.push({\n message: `Could not determine new digest for update (${config.datasource} package ${config.packageName})`,\n topic: config.packageName,\n });\n }\n }\n } else {\n delete update.newDigest;\n }\n if (update.newVersion) {\n const registryUrl = dependency?.releases?.find(\n (release) => release.version === update.newVersion,\n )?.registryUrl;\n if (registryUrl && registryUrl !== res.registryUrl) {\n update.registryUrl = registryUrl;\n }\n }\n }\n }\n\n if (res.updates.length) {\n delete res.skipReason;\n }\n // Strip out any non-changed ones\n res.updates = res.updates\n .filter(\n (update) => update.newValue !== null || config.currentValue === null,\n )\n .filter((update) => update.newDigest !== null)\n .filter(\n (update) =>\n (isString(update.newName) && update.newName !== config.packageName) ||\n update.isReplacement === true ||\n update.newValue !== config.currentValue ||\n update.isLockfileUpdate === true ||\n // TODO #22198\n (update.newDigest &&\n !update.newDigest.startsWith(config.currentDigest!)),\n );\n // If range strategy specified in config is 'in-range-only', also strip out updates where currentValue !== newValue\n if (config.rangeStrategy === 'in-range-only') {\n res.updates = res.updates.filter(\n (update) => update.newValue === config.currentValue,\n );\n }\n // Handle a weird edge case involving followTag and fallbacks\n if (config.rollbackPrs && config.followTag) {\n res.updates = res.updates.filter(\n (update) =>\n update.updateType !== 'rollback' || res.updates.length === 1,\n );\n }\n\n // If there is a digest update proposed which is in the pending updates for this dependency, ensure that `minimumReleaseAge` is applied.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `digestUpdate` never is - true is a safe constant.\n if (digestUpdate && res.updates.includes(digestUpdate)) {\n await applyMinimumReleaseAgeToDigestUpdate(\n digestUpdate,\n config,\n res,\n true,\n newestMatchingVersionTimestamp,\n );\n }\n\n const release =\n res.updates.length > 0\n ? (dependency?.releases.find(\n (r) => r.version === res.updates[0].newValue,\n ) ??\n dependency?.releases.find(\n (r) => r.version === res.updates[0].newVersion,\n ))\n : null;\n\n if (release?.changelogContent) {\n res.changelogContent = release.changelogContent;\n res.changelogUrl = release.changelogUrl;\n }\n } catch (err) /* istanbul ignore next */ {\n if (err instanceof ExternalHostError) {\n return Result.err(err);\n }\n\n if (err instanceof Error && err.message === CONFIG_VALIDATION) {\n return Result.err(err);\n }\n\n logger.error(\n {\n currentDigest: config.currentDigest,\n currentValue: config.currentValue,\n datasource: config.datasource,\n packageName: config.packageName,\n digestOneAndOnly: config.digestOneAndOnly,\n followTag: config.followTag,\n lockedVersion: config.lockedVersion,\n packageFile: config.packageFile,\n pinDigests: config.pinDigests,\n rollbackPrs: config.rollbackPrs,\n isVulnerabilityAlert: config.isVulnerabilityAlert,\n updatePinnedDependencies: config.updatePinnedDependencies,\n err,\n },\n 'lookupUpdates error',\n );\n res.skipReason = 'internal-error';\n }\n return Result.ok(res);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,eAAe,aACb,QACA,UACA,SACA,eACuC;CACvC,MAAM,iBAAiB,SAAS,MAC7B,MACC,cAAc,QAAQ,EAAE,OAAO,KAC/B,cAAc,OAAO,EAAE,SAAS,OAAO,CAC3C;CAEA,IAAI,CAAC,gBACH,OAAO;CAGT,IAAI,eAAe,kBACjB,OAAO,eAAe;CAIxB,QAAO,MADqB,mBAAmB,QAAQ,cAAc,EAAA,EAC/C;AACxB;;;;;;AAUA,SAAS,oCACP,QACA,YACS;CAIT,IAAI,OAAO,yBAAy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AAO,OAAO,IAAI,GAAG;EAGvB,IAAI,eAAe,SAAS,IAAI,YAAA,qBAC9B,OAAO,OAAO,IAAI,GAAG;EAGvB,OAAO,MACL;GACE,eAAe,OAAO;GACtB,cAAc,OAAO;GACrB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,kBAAkB,OAAO;GACzB,WAAW,OAAO;GAClB,eAAe,OAAO;GACtB,aAAa,OAAO;GACpB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,sBAAsB,OAAO;GAC7B,0BAA0B,OAAO;GACjC;EACF,GACA,qBACF;EACA,IAAI,aAAa;CACnB;CACA,OAAO,OAAO,GAAG,GAAG;AACtB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["allVersioning.get"],"sources":["../../../../../lib/workers/repository/process/lookup/index.ts"],"sourcesContent":["import { isNonEmptyString, isString, isUndefined } from '@sindresorhus/is';\nimport { mergeChildConfig } from '../../../../config/index.ts';\nimport type { ValidationMessage } from '../../../../config/types.ts';\nimport { CONFIG_VALIDATION } from '../../../../constants/error-messages.ts';\nimport { logger } from '../../../../logger/index.ts';\nimport {\n getDatasourceFor,\n getDefaultVersioning,\n} from '../../../../modules/datasource/common.ts';\nimport type {\n GetDigestInputConfig,\n Release,\n ReleaseResult,\n} from '../../../../modules/datasource/index.ts';\nimport {\n applyDatasourceFilters,\n getDigest,\n getRawPkgReleases,\n isGetPkgReleasesConfig,\n supportsDigests,\n} from '../../../../modules/datasource/index.ts';\nimport { postprocessRelease } from '../../../../modules/datasource/postprocess-release.ts';\nimport { getRangeStrategy } from '../../../../modules/manager/index.ts';\nimport type { LookupUpdate } from '../../../../modules/manager/types.ts';\nimport { id as dockerVersioningId } from '../../../../modules/versioning/docker/index.ts';\nimport * as allVersioning from '../../../../modules/versioning/index.ts';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error.ts';\nimport { assignKeys } from '../../../../util/assign-keys.ts';\nimport { getElapsedDays } from '../../../../util/date.ts';\nimport { checkMinimumReleaseAge } from '../../../../util/minimum-release-age.ts';\nimport { applyPackageRules } from '../../../../util/package-rules/index.ts';\nimport { regEx } from '../../../../util/regex.ts';\nimport { Result } from '../../../../util/result.ts';\nimport { safeStringify } from '../../../../util/stringify.ts';\nimport type { Timestamp } from '../../../../util/timestamp.ts';\nimport { calculateAbandonment } from './abandonment.ts';\nimport { getBucket } from './bucket.ts';\nimport { getCurrentVersion } from './current.ts';\nimport { filterVersions } from './filter.ts';\nimport { filterInternalChecks } from './filter-checks.ts';\nimport { generateUpdate } from './generate.ts';\nimport { getRollbackUpdate } from './rollback.ts';\nimport { calculateMostRecentTimestamp } from './timestamps.ts';\nimport type { LookupUpdateConfig, UpdateResult } from './types.ts';\nimport {\n addReplacementUpdateIfValid,\n isReplacementRulesConfigured,\n} from './utils.ts';\n\nasync function getTimestamp(\n config: LookupUpdateConfig,\n versions: Release[],\n version: string,\n versioningApi: allVersioning.VersioningApi,\n): Promise<Timestamp | null | undefined> {\n const currentRelease = versions.find(\n (v) =>\n versioningApi.isValid(v.version) &&\n versioningApi.equals(v.version, version),\n );\n\n if (!currentRelease) {\n return null;\n }\n\n if (currentRelease.releaseTimestamp) {\n return currentRelease.releaseTimestamp;\n }\n\n const remoteRelease = await postprocessRelease(config, currentRelease);\n return remoteRelease?.releaseTimestamp;\n}\n\n/** The only two `updateType`s that `applyMinimumReleaseAgeToDigestUpdate()` can be called with */\ntype DigestLikeUpdate = LookupUpdate & { updateType: 'digest' | 'pinDigest' };\n\n/**\n * A helper function to allow a short-circuit for `minimumReleaseAge` functionality if a package may have config that applies it.\n *\n * Allows avoiding unnecessary calls to more expensive checks like merge + `applyPackageRules()` and `getTimestamp()`.\n */\nfunction couldApplyMinimumReleaseAgeToDigest(\n config: LookupUpdateConfig,\n updateType: DigestLikeUpdate['updateType'],\n): boolean {\n // Match filterInternalChecks(): under `none` the user opted out of internal\n // checks entirely, so do no merging, no package rules, no age check and no\n // logging claiming an age check ran.\n if (config.internalChecksFilter === 'none') {\n return false;\n }\n\n return (\n isNonEmptyString(config.minimumReleaseAge) ||\n isNonEmptyString(config[updateType]?.minimumReleaseAge) ||\n !!config.packageRules?.some((rule) =>\n isNonEmptyString(rule.minimumReleaseAge),\n )\n );\n}\n\n/**\n * Ensure `minimumReleaseAge`/`internalChecksFilter` applies to digest/pinDigest updates, as they don't currently get run through `filterInternalChecks()`.\n *\n * NOTE that this should be kept in sync with `filterInternalChecks`()\n */\nasync function applyMinimumReleaseAgeToDigestUpdate(\n update: DigestLikeUpdate,\n config: LookupUpdateConfig,\n res: UpdateResult,\n currentVersionWasResolved: boolean,\n newestMatchingVersionTimestamp: Timestamp | null | undefined,\n): Promise<void> {\n if (!couldApplyMinimumReleaseAgeToDigest(config, update.updateType)) {\n return;\n }\n\n if (update.updateType === 'pinDigest' && !currentVersionWasResolved) {\n // Not `!res.currentVersion` - that's force-set to lockedVersion further down regardless of timestamp resolution.\n // `pinDigest` doesn't repoint anywhere, unlike `digest` - it just freezes whatever the ref already resolves to.\n // An unversioned tag (e.g. `latest`) has no versioned release to age against, and holding the pin would only\n // prolong the less-pinned (less safe) state, so skip the check entirely rather than treating the missing\n // timestamp as pending.\n logger.once.debug(\n { depName: config.depName, updateType: update.updateType },\n `Skipping minimumReleaseAge check for ${update.updateType} update of ${config.depName}, as its current value does not resolve to a versioned release`,\n );\n return;\n }\n\n let releaseConfig: LookupUpdateConfig = {\n ...mergeChildConfig(config, res),\n updateType: update.updateType,\n };\n releaseConfig = mergeChildConfig(\n releaseConfig,\n releaseConfig[update.updateType]!,\n );\n releaseConfig = await applyPackageRules(releaseConfig, 'update-type');\n\n // Not update.releaseTimestamp - that field means \"age of the new release\" elsewhere (generate.ts, libyear.ts).\n // Not res.currentVersionTimestamp either - that tracks whatever rangeStrategy resolves currentVersion to (e.g.\n // the oldest matching release under `bump`), whereas both `digest` and `pinDigest` reflect whatever the current\n // value's ref actually resolves to *right now*, which is always the newest matching version.\n const ageCheck = checkMinimumReleaseAge(\n releaseConfig,\n newestMatchingVersionTimestamp,\n );\n\n // Mirror filterInternalChecks()'s logging so a held/passed digest update is diagnosable.\n if (ageCheck.minimumReleaseAgeMs && !ageCheck.hasTimestamp) {\n if (releaseConfig.minimumReleaseAgeBehaviour === 'timestamp-optional') {\n logger.once.warn(\n \"Some release(s) did not have a releaseTimestamp, but as we're running with minimumReleaseAgeBehaviour=timestamp-optional, proceeding. See debug logs for more information\",\n );\n }\n\n logger.once.debug(\n {\n depName: config.depName,\n updateType: update.updateType,\n minimumReleaseAgeBehaviour: releaseConfig.minimumReleaseAgeBehaviour,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update of ${config.depName} has no releaseTimestamp to age against`,\n );\n }\n if (ageCheck.isPending) {\n logger.trace(\n {\n depName: config.depName,\n updateType: update.updateType,\n releaseTimestamp: newestMatchingVersionTimestamp,\n check: 'minimumReleaseAge',\n },\n `${update.updateType} update is pending minimumReleaseAge status checks`,\n );\n\n // internalChecksFilter is read from the unmerged top-level config, like filterInternalChecks().\n if (config.internalChecksFilter === 'strict') {\n update.pendingChecks = true;\n }\n }\n}\n\nexport async function lookupUpdates(\n inconfig: LookupUpdateConfig,\n): Promise<Result<UpdateResult>> {\n let config: LookupUpdateConfig = { ...inconfig };\n config.versioning ??= getDefaultVersioning(config.datasource);\n\n const versioningApi = allVersioning.get(config.versioning);\n\n let dependency: ReleaseResult | null = null;\n const res: UpdateResult = {\n versioning: config.versioning,\n updates: [],\n warnings: [],\n };\n // Timestamp of the release a `digest`/`pinDigest` update's current value currently resolves to (the newest version matching it, regardless of `rangeStrategy`), as opposed to `res.currentVersionTimestamp` which tracks whatever the configured rangeStrategy resolves `currentVersion` to (e.g. the oldest for `bump`)\n let newestMatchingVersionTimestamp: Timestamp | null | undefined;\n // The `digest` update for `config.currentDigest` (if one is added), so its age check can run after `newDigest` is fetched and no-op updates are stripped.\n let digestUpdate: DigestLikeUpdate | undefined;\n\n try {\n logger.trace(\n {\n dependency: config.packageName,\n currentValue: config.currentValue,\n },\n 'lookupUpdates',\n );\n if (config.currentValue && !isString(config.currentValue)) {\n // If currentValue is not a string, then it's invalid\n logger.debug(\n `Invalid currentValue for ${config.packageName}: ${safeStringify(config.currentValue)} (${typeof config.currentValue})`,\n );\n res.skipReason = 'invalid-value';\n return Result.ok(res);\n }\n if (\n !isGetPkgReleasesConfig(config) ||\n !getDatasourceFor(config.datasource)\n ) {\n res.skipReason = 'invalid-config';\n return Result.ok(res);\n }\n let compareValue = config.currentValue;\n if (\n isString(config.currentValue) &&\n isString(config.versionCompatibility)\n ) {\n const versionCompatbilityRegEx = regEx(config.versionCompatibility);\n const regexMatch = versionCompatbilityRegEx.exec(config.currentValue);\n if (regexMatch?.groups) {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n groups: regexMatch.groups,\n },\n 'version compatibility regex match',\n );\n config.currentCompatibility = regexMatch.groups.compatibility;\n res.currentCompatibility = regexMatch.groups.compatibility;\n compareValue = regexMatch.groups.version;\n } else {\n logger.debug(\n {\n versionCompatibility: config.versionCompatibility,\n currentValue: config.currentValue,\n packageName: config.packageName,\n },\n 'version compatibility regex mismatch',\n );\n }\n }\n\n const isValid =\n isString(compareValue) && versioningApi.isValid(compareValue);\n\n const unconstrainedValue =\n !!config.lockedVersion && isUndefined(config.currentValue);\n\n if (isValid || unconstrainedValue) {\n if (\n !config.updatePinnedDependencies &&\n // TODO #22198\n versioningApi.isSingleVersion(compareValue!)\n ) {\n res.skipReason = 'is-pinned';\n return Result.ok(res);\n }\n\n const { val: releaseResult, err: lookupError } = await getRawPkgReleases(\n config,\n )\n .transform((res) => calculateMostRecentTimestamp(versioningApi, res))\n .transform((res) => calculateAbandonment(res, config))\n .transform((res) => applyDatasourceFilters(res, config))\n .unwrap();\n\n if (lookupError instanceof Error) {\n throw lookupError;\n }\n\n if (lookupError) {\n // If dependency lookup fails then warn and return\n const warning: ValidationMessage = {\n topic: config.packageName,\n message: `Failed to look up ${config.datasource} package ${config.packageName}: ${lookupError}`,\n };\n logger.debug(\n {\n dependency: config.packageName,\n packageFile: config.packageFile,\n },\n warning.message,\n );\n // TODO: return warnings in own field\n res.warnings.push(warning);\n return Result.ok(res);\n }\n\n dependency = releaseResult;\n\n if (dependency.deprecationMessage) {\n logger.debug(\n `Found deprecationMessage for ${config.datasource} package ${config.packageName}`,\n );\n }\n\n assignKeys(res, dependency, [\n 'deprecationMessage',\n 'sourceUrl',\n 'registryUrl',\n 'sourceDirectory',\n 'homepage',\n 'changelogUrl',\n 'dependencyUrl',\n 'lookupName',\n 'packageScope',\n 'mostRecentTimestamp',\n 'isAbandoned',\n 'respectLatest',\n ]);\n\n const latestVersion = dependency.tags?.latest;\n // Filter out any results from datasource that don't comply with our versioning\n let allVersions = dependency.releases.filter((release) =>\n versioningApi.isVersion(release.version),\n );\n const allReleaseVersions = new Set(allVersions.map((r) => r.version));\n // istanbul ignore if\n if (allVersions.length === 0) {\n const message = `Found no results from datasource that look like a version`;\n logger.info(\n {\n dependency: config.packageName,\n result: dependency,\n },\n message,\n );\n if (!config.currentDigest) {\n return Result.ok(res);\n }\n }\n // Reapply package rules in case we missed something from sourceUrl\n config = await applyPackageRules(\n { ...config, sourceUrl: res.sourceUrl },\n 'source-url',\n );\n if (config.followTag) {\n const taggedVersion = dependency.tags?.[config.followTag];\n if (!taggedVersion) {\n res.warnings.push({\n topic: config.packageName,\n message: `Can't find version with tag ${config.followTag} for ${config.datasource} package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n allVersions = allVersions.filter(\n (v) =>\n v.version === taggedVersion ||\n (v.version === compareValue &&\n versioningApi.isGreaterThan(taggedVersion, compareValue)),\n );\n }\n\n const inRangeOnlyStrategy = config.rangeStrategy === 'in-range-only';\n // Check that existing constraint can be satisfied\n const allSatisfyingVersions =\n (inRangeOnlyStrategy || config.rollbackPrs) && !unconstrainedValue\n ? allVersions.filter((v) =>\n // TODO #22198\n versioningApi.matches(v.version, compareValue!),\n )\n : allVersions;\n if (!allSatisfyingVersions.length) {\n logger.debug(\n `Found no satisfying versions with '${config.versioning}' versioning`,\n );\n }\n\n if (config.rollbackPrs && !allSatisfyingVersions.length) {\n const rollback = getRollbackUpdate(config, allVersions, versioningApi);\n // istanbul ignore if\n if (!rollback) {\n res.warnings.push({\n topic: config.packageName,\n // TODO: types (#22198)\n message: `Can't find version matching ${compareValue!} for ${\n config.datasource\n } package ${config.packageName}`,\n });\n return Result.ok(res);\n }\n res.updates.push(rollback);\n }\n let rangeStrategy = getRangeStrategy(config);\n\n // istanbul ignore next\n if (\n config.isVulnerabilityAlert &&\n rangeStrategy === 'update-lockfile' &&\n !config.lockedVersion\n ) {\n rangeStrategy = 'bump';\n }\n // unconstrained deps with lockedVersion\n if (\n config.isVulnerabilityAlert &&\n !config.currentValue &&\n config.lockedVersion\n ) {\n rangeStrategy = 'update-lockfile';\n }\n const nonDeprecatedVersions = dependency.releases\n .filter((release) => !release.isDeprecated)\n .map((release) => release.version);\n let currentVersion: string;\n if (rangeStrategy === 'update-lockfile') {\n currentVersion = config.lockedVersion!;\n } else if (\n compareValue &&\n versioningApi.isSingleVersion(compareValue) &&\n allVersions.find((v) => v.version === compareValue)\n ) {\n currentVersion = compareValue;\n }\n // TODO #22198\n currentVersion ??=\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n nonDeprecatedVersions,\n ) ??\n getCurrentVersion(\n compareValue!,\n config.lockedVersion!,\n versioningApi,\n rangeStrategy!,\n latestVersion!,\n allVersions.map((v) => v.version),\n )!;\n\n if (!currentVersion) {\n // v8 ignore else -- TODO: add test #40625\n if (!config.lockedVersion) {\n logger.debug(\n `No currentVersion or lockedVersion found for ${config.packageName}`,\n );\n res.skipReason = 'invalid-value';\n }\n return Result.ok(res);\n }\n\n res.currentVersion = currentVersion;\n\n // Use lockedVersion for the timestamp lookup when available, because\n // res.currentVersion is later overwritten to lockedVersion (see below).\n // Without this, strategies like \"replace\" would compute the timestamp\n // for the highest satisfying version (e.g. 1.4.1) while the reported\n // currentVersion ends up being the locked one (e.g. 1.0.0).\n const versionForTimestamp = config.lockedVersion ?? currentVersion;\n const currentVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n versionForTimestamp,\n versioningApi,\n );\n\n if (isNonEmptyString(currentVersionTimestamp)) {\n res.currentVersionTimestamp = currentVersionTimestamp;\n res.currentVersionAgeInDays = getElapsedDays(currentVersionTimestamp);\n\n if (\n config.packageRules?.some((rule) =>\n isNonEmptyString(rule.matchCurrentAge),\n )\n ) {\n // Reapply package rules to check matches for matchCurrentAge\n config = await applyPackageRules(\n { ...config, currentVersionTimestamp },\n 'current-timestamp',\n );\n }\n }\n\n if (\n config.currentDigest\n ? couldApplyMinimumReleaseAgeToDigest(config, 'digest')\n : config.pinDigests &&\n couldApplyMinimumReleaseAgeToDigest(config, 'pinDigest')\n ) {\n // Resolve from `allVersions` (not `dependency.releases`) so that filters like followTag apply, preferring non-deprecated versions with a fallback - both like the `currentVersion` resolution above.\n const newestMatchingVersion =\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.filter((v) => !v.isDeprecated).map((v) => v.version),\n ) ??\n getCurrentVersion(\n compareValue!,\n '',\n versioningApi,\n 'replace',\n latestVersion!,\n allVersions.map((v) => v.version),\n );\n if (newestMatchingVersion) {\n newestMatchingVersionTimestamp = await getTimestamp(\n config,\n allVersions,\n newestMatchingVersion,\n versioningApi,\n );\n }\n }\n\n if (\n compareValue &&\n currentVersion &&\n rangeStrategy === 'pin' &&\n !versioningApi.isSingleVersion(compareValue)\n ) {\n const newValue =\n versioningApi.getPinnedValue?.(currentVersion) ?? currentVersion;\n res.updates.push({\n updateType: 'pin',\n isPin: true,\n newValue,\n newVersion: currentVersion,\n newMajor: versioningApi.getMajor(currentVersion)!,\n });\n }\n if (rangeStrategy === 'pin') {\n // Fall back to replace once pinning logic is done\n rangeStrategy = 'replace';\n }\n // istanbul ignore if\n if (!versioningApi.isVersion(currentVersion!)) {\n res.skipReason = 'invalid-version';\n return Result.ok(res);\n }\n // Filter latest, unstable, etc\n // TODO #22198\n let filteredReleases = filterVersions(\n config,\n currentVersion!,\n latestVersion!,\n inRangeOnlyStrategy ? allSatisfyingVersions : allVersions,\n versioningApi,\n ).filter(\n (v) =>\n // Leave only compatible versions\n unconstrainedValue ||\n versioningApi.isCompatible(v.version, compareValue),\n );\n let shrinkedViaVulnerability = false;\n if (config.isVulnerabilityAlert) {\n if (config.vulnerabilityFixVersion) {\n res.vulnerabilityFixVersion = config.vulnerabilityFixVersion;\n res.vulnerabilityFixStrategy = config.vulnerabilityFixStrategy;\n if (versioningApi.isValid(config.vulnerabilityFixVersion)) {\n let fixedFilteredReleases;\n if (versioningApi.isVersion(config.vulnerabilityFixVersion)) {\n // Retain only releases greater than or equal to the fix version\n fixedFilteredReleases = filteredReleases.filter(\n (release) =>\n !versioningApi.isGreaterThan(\n config.vulnerabilityFixVersion!,\n release.version,\n ),\n );\n } else {\n // Retain only releases which max the fix constraint\n fixedFilteredReleases = filteredReleases.filter((release) =>\n versioningApi.matches(\n release.version,\n config.vulnerabilityFixVersion!,\n ),\n );\n }\n // Warn if this filtering results caused zero releases\n if (fixedFilteredReleases.length === 0 && filteredReleases.length) {\n logger.warn(\n {\n releases: filteredReleases,\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'No releases satisfy vulnerabilityFixVersion',\n );\n }\n // Use the additionally filtered releases\n filteredReleases = fixedFilteredReleases;\n } else {\n logger.warn(\n {\n vulnerabilityFixVersion: config.vulnerabilityFixVersion,\n packageName: config.packageName,\n },\n 'vulnerabilityFixVersion is not valid',\n );\n }\n }\n if (config.vulnerabilityFixStrategy === 'highest') {\n // Don't shrink the list of releases - let Renovate use its normal logic\n logger.once.debug(\n `Using vulnerabilityFixStrategy=highest for ${config.packageName}`,\n );\n } else {\n // Shrink the list of releases to the lowest fixed version\n logger.once.debug(\n `Using vulnerabilityFixStrategy=lowest for ${config.packageName}`,\n );\n filteredReleases = filteredReleases.slice(0, 1);\n shrinkedViaVulnerability = true;\n }\n }\n const buckets: Record<string, [Release]> = {};\n for (const release of filteredReleases) {\n const bucket = getBucket(\n config,\n // TODO #22198\n currentVersion!,\n release.version,\n versioningApi,\n );\n // v8 ignore else -- TODO: add test #40625\n if (isString(bucket)) {\n if (buckets[bucket]) {\n buckets[bucket].push(release);\n } else {\n buckets[bucket] = [release];\n }\n }\n }\n const depResultConfig = mergeChildConfig(config, res);\n for (const [bucket, releases] of Object.entries(buckets)) {\n const sortedReleases = releases.sort((r1, r2) =>\n versioningApi.sortVersions(r1.version, r2.version),\n );\n const { release, pendingChecks, pendingReleases } =\n await filterInternalChecks(\n depResultConfig,\n versioningApi,\n bucket,\n sortedReleases,\n );\n // istanbul ignore next\n if (!release) {\n return Result.ok(res);\n }\n const newVersion = release.version;\n const update = await generateUpdate(\n config,\n compareValue,\n versioningApi,\n // TODO #22198\n\n rangeStrategy!,\n config.lockedVersion ?? currentVersion!,\n bucket,\n release,\n allReleaseVersions,\n );\n\n // #29034\n if (\n config.manager === 'gomod' &&\n compareValue?.startsWith('v0.0.0-') &&\n update.newValue?.startsWith('v0.0.0-') &&\n config.currentDigest !== update.newDigest\n ) {\n update.updateType = 'digest';\n\n // As this has already been processed by `filterInternalChecks()`, but we're changing the `updateType`, we need to apply the digest-scoped minimumReleaseAge rules.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `update.updateType` never is here - true is a safe constant.\n await applyMinimumReleaseAgeToDigestUpdate(\n update as DigestLikeUpdate,\n config,\n res,\n true,\n release.releaseTimestamp,\n );\n }\n\n if (pendingChecks) {\n update.pendingChecks = pendingChecks;\n }\n\n if (pendingReleases.length) {\n update.pendingVersions = pendingReleases.map((r) => r.version);\n }\n if (!update.newValue || update.newValue === compareValue) {\n if (!config.lockedVersion) {\n continue;\n }\n // istanbul ignore if\n if (rangeStrategy === 'bump') {\n logger.trace(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n lockedVersion: config.lockedVersion,\n newVersion,\n },\n 'Skipping bump because newValue is the same',\n );\n continue;\n }\n res.isSingleVersion = true;\n }\n res.isSingleVersion ??=\n isString(update.newValue) &&\n versioningApi.isSingleVersion(update.newValue);\n // istanbul ignore if\n if (\n config.versioning === dockerVersioningId &&\n update.updateType !== 'rollback' &&\n update.newValue &&\n versioningApi.isVersion(update.newValue) &&\n compareValue &&\n versioningApi.isVersion(compareValue) &&\n versioningApi.isGreaterThan(compareValue, update.newValue)\n ) {\n logger.warn(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n compareValue,\n currentVersion: config.currentVersion,\n update,\n allVersionsLength: allVersions.length,\n filteredReleaseVersions: filteredReleases.map((r) => r.version),\n shrinkedViaVulnerability,\n },\n 'Unexpected downgrade detected: skipping',\n );\n } else {\n res.updates.push(update);\n }\n }\n } else if (compareValue) {\n logger.debug(\n `Dependency ${config.packageName} has unsupported/unversioned value ${compareValue} (versioning=${config.versioning})`,\n );\n\n if (!config.pinDigests && !config.currentDigest) {\n logger.debug(\n `Skipping ${config.packageName} because no currentDigest or pinDigests`,\n );\n res.skipReason = 'invalid-value';\n } else {\n delete res.skipReason;\n }\n } else {\n res.skipReason = 'invalid-value';\n }\n\n if (isReplacementRulesConfigured(config)) {\n addReplacementUpdateIfValid(res.updates, config);\n } else if (dependency?.replacementName && dependency.replacementVersion) {\n res.updates.push({\n updateType: 'replacement',\n newName: dependency.replacementName,\n newValue: dependency.replacementVersion,\n });\n }\n\n // Record if the dep is fixed to a version\n if (config.lockedVersion) {\n res.currentVersion = config.lockedVersion;\n res.fixedVersion = config.lockedVersion;\n } else if (compareValue && versioningApi.isSingleVersion(compareValue)) {\n res.fixedVersion = compareValue.replace(regEx(/^=+/), '');\n }\n\n // massage versionCompatibility\n if (\n isString(config.currentValue) &&\n isString(compareValue) &&\n isString(config.versionCompatibility)\n ) {\n for (const update of res.updates) {\n logger.debug({ update });\n // v8 ignore else -- TODO: add test #40625\n if (isString(config.currentValue) && isString(update.newValue)) {\n update.newValue = config.currentValue.replace(\n compareValue,\n update.newValue,\n );\n }\n }\n }\n\n // Add digests if necessary\n if (supportsDigests(config.datasource)) {\n if (config.currentDigest) {\n if (!config.digestOneAndOnly || !res.updates.length) {\n // digest update - age-checked after the strip below, once newDigest is known\n digestUpdate = {\n updateType: 'digest',\n newValue: config.currentValue,\n };\n res.updates.push(digestUpdate);\n }\n } else if (\n config.pinDigests &&\n // only update the digest in the package file if it's managed by us\n !config.digestManagedExternally &&\n // Create a pin only if one doesn't already exists\n // v8 ignore else -- TODO: add test #40625\n !res.updates.some((update) => update.updateType === 'pin')\n ) {\n // pin digest\n const pinDigestUpdate: DigestLikeUpdate = {\n isPinDigest: true,\n updateType: 'pinDigest',\n newValue: config.currentValue,\n };\n await applyMinimumReleaseAgeToDigestUpdate(\n pinDigestUpdate,\n config,\n res,\n isValid || unconstrainedValue,\n newestMatchingVersionTimestamp,\n );\n res.updates.push(pinDigestUpdate);\n }\n if (versioningApi.valueToVersion) {\n // TODO #22198\n res.currentVersion = versioningApi.valueToVersion(res.currentVersion!);\n for (const update of res.updates) {\n // TODO #22198\n update.newVersion = versioningApi.valueToVersion(update.newVersion!);\n }\n }\n if (res.registryUrl) {\n config.registryUrls = [res.registryUrl];\n }\n\n // update digest for all\n for (const update of res.updates) {\n // only update the digest in the package file if it's managed by us\n if (\n (config.pinDigests === true && !config.digestManagedExternally) ||\n config.currentDigest\n ) {\n const getDigestConfig: GetDigestInputConfig = {\n ...config,\n registryUrl: update.registryUrl ?? res.registryUrl,\n lookupName: res.lookupName,\n };\n\n // #20304 only pass it for replacement updates, otherwise we get wrong or invalid digest\n if (update.updateType !== 'replacement') {\n delete getDigestConfig.replacementName;\n }\n\n // #20304 don't use lookupName and currentDigest when we replace image name\n if (\n update.updateType === 'replacement' &&\n update.newName !== config.packageName\n ) {\n delete getDigestConfig.lookupName;\n delete getDigestConfig.currentDigest;\n getDigestConfig.replacementName = update.newName;\n }\n\n // Don't use current releases if replacement changes name, otherwise we use the wrong new digest.\n // This happens on datasources which return the digest in release info like `github-tags`.\n // We can still use it when only version is changing.\n if (\n update.updateType !== 'replacement' ||\n update.newName === config.packageName\n ) {\n update.newDigest ??= dependency?.releases.find(\n (r) => r.version === update.newValue,\n )?.newDigest;\n }\n\n update.newDigest ??= await getDigest(\n getDigestConfig,\n update.newValue,\n );\n\n // If the digest could not be determined, report this as otherwise the\n // update will be omitted later on without notice.\n if (update.newDigest === null) {\n logger.debug(\n {\n packageName: config.packageName,\n currentValue: config.currentValue,\n datasource: config.datasource,\n newValue: update.newValue,\n bucket: update.bucket,\n },\n 'Could not determine new digest for update.',\n );\n\n // Only report a warning if there is a current digest.\n // Context: https://github.com/renovatebot/renovate/pull/20175#discussion_r1102615059.\n if (config.currentDigest) {\n res.warnings.push({\n message: `Could not determine new digest for update (${config.datasource} package ${config.packageName})`,\n topic: config.packageName,\n });\n }\n }\n } else {\n delete update.newDigest;\n }\n if (update.newVersion) {\n const registryUrl = dependency?.releases?.find(\n (release) => release.version === update.newVersion,\n )?.registryUrl;\n if (registryUrl && registryUrl !== res.registryUrl) {\n update.registryUrl = registryUrl;\n }\n }\n }\n }\n\n if (res.updates.length) {\n delete res.skipReason;\n }\n // Strip out any non-changed ones\n res.updates = res.updates\n .filter(\n (update) => update.newValue !== null || config.currentValue === null,\n )\n .filter((update) => update.newDigest !== null)\n .filter(\n (update) =>\n (isString(update.newName) && update.newName !== config.packageName) ||\n update.isReplacement === true ||\n update.newValue !== config.currentValue ||\n update.isLockfileUpdate === true ||\n // TODO #22198\n (update.newDigest &&\n !update.newDigest.startsWith(config.currentDigest!)),\n );\n // If range strategy specified in config is 'in-range-only', also strip out updates where currentValue !== newValue\n if (config.rangeStrategy === 'in-range-only') {\n res.updates = res.updates.filter(\n (update) => update.newValue === config.currentValue,\n );\n }\n // Handle a weird edge case involving followTag and fallbacks\n if (config.rollbackPrs && config.followTag) {\n res.updates = res.updates.filter(\n (update) =>\n update.updateType !== 'rollback' || res.updates.length === 1,\n );\n }\n\n // If there is a digest update proposed which is in the pending updates for this dependency, ensure that `minimumReleaseAge` is applied.\n // `currentVersionWasResolved` only matters for `pinDigest`, which `digestUpdate` never is - true is a safe constant.\n if (digestUpdate && res.updates.includes(digestUpdate)) {\n await applyMinimumReleaseAgeToDigestUpdate(\n digestUpdate,\n config,\n res,\n true,\n newestMatchingVersionTimestamp,\n );\n }\n\n const release =\n res.updates.length > 0\n ? (dependency?.releases.find(\n (r) => r.version === res.updates[0].newValue,\n ) ??\n dependency?.releases.find(\n (r) => r.version === res.updates[0].newVersion,\n ))\n : null;\n\n if (release?.changelogContent) {\n res.changelogContent = release.changelogContent;\n res.changelogUrl = release.changelogUrl;\n }\n } catch (err) /* istanbul ignore next */ {\n if (err instanceof ExternalHostError) {\n return Result.err(err);\n }\n\n if (err instanceof Error && err.message === CONFIG_VALIDATION) {\n return Result.err(err);\n }\n\n logger.error(\n {\n currentDigest: config.currentDigest,\n currentValue: config.currentValue,\n datasource: config.datasource,\n packageName: config.packageName,\n digestOneAndOnly: config.digestOneAndOnly,\n followTag: config.followTag,\n lockedVersion: config.lockedVersion,\n packageFile: config.packageFile,\n pinDigests: config.pinDigests,\n rollbackPrs: config.rollbackPrs,\n isVulnerabilityAlert: config.isVulnerabilityAlert,\n updatePinnedDependencies: config.updatePinnedDependencies,\n err,\n },\n 'lookupUpdates error',\n );\n res.skipReason = 'internal-error';\n }\n return Result.ok(res);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,eAAe,aACb,QACA,UACA,SACA,eACuC;CACvC,MAAM,iBAAiB,SAAS,MAC7B,MACC,cAAc,QAAQ,EAAE,OAAO,KAC/B,cAAc,OAAO,EAAE,SAAS,OAAO,CAC3C;CAEA,IAAI,CAAC,gBACH,OAAO;CAGT,IAAI,eAAe,kBACjB,OAAO,eAAe;CAIxB,QAAO,MADqB,mBAAmB,QAAQ,cAAc,EAAA,EAC/C;AACxB;;;;;;AAUA,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IAAI,eAAe,mBACjB,OAAO,OAAO,IAAI,GAAG;EAGvB,IAAI,eAAe,SAAS,IAAI,YAAA,qBAC9B,OAAO,OAAO,IAAI,GAAG;EAGvB,OAAO,MACL;GACE,eAAe,OAAO;GACtB,cAAc,OAAO;GACrB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,kBAAkB,OAAO;GACzB,WAAW,OAAO;GAClB,eAAe,OAAO;GACtB,aAAa,OAAO;GACpB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,sBAAsB,OAAO;GAC7B,0BAA0B,OAAO;GACjC;EACF,GACA,qBACF;EACA,IAAI,aAAa;CACnB;CACA,OAAO,OAAO,GAAG,GAAG;AACtB"}
|
|
@@ -2,7 +2,7 @@ import { fromBase64 } from "../../../../../../util/string.js";
|
|
|
2
2
|
import { logger } from "../../../../../../logger/index.js";
|
|
3
3
|
import { ForgejoHttp } from "../../../../../../util/http/forgejo.js";
|
|
4
4
|
import { Releases } from "../../../../../../modules/datasource/forgejo-releases/schema.js";
|
|
5
|
-
import { ContentsListResponse, RepoContents } from "../../../../../../modules/platform/
|
|
5
|
+
import { ContentsListResponse, RepoContents } from "../../../../../../modules/platform/gitea/schema.js";
|
|
6
6
|
import { compareChangelogFilePath } from "../common.js";
|
|
7
7
|
import changelogFilenameRegex from "changelog-filename-regex";
|
|
8
8
|
//#region lib/workers/repository/update/pr/changelog/forgejo/index.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../lib/workers/repository/update/pr/changelog/forgejo/index.ts"],"sourcesContent":["import changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../../../../logger/index.ts';\nimport { Releases } from '../../../../../../modules/datasource/forgejo-releases/schema.ts';\nimport {\n ContentsListResponse,\n RepoContents,\n} from '../../../../../../modules/platform/
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../lib/workers/repository/update/pr/changelog/forgejo/index.ts"],"sourcesContent":["import changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../../../../logger/index.ts';\nimport { Releases } from '../../../../../../modules/datasource/forgejo-releases/schema.ts';\nimport {\n ContentsListResponse,\n RepoContents,\n} from '../../../../../../modules/platform/gitea/schema.ts';\nimport { ForgejoHttp } from '../../../../../../util/http/forgejo.ts';\nimport { fromBase64 } from '../../../../../../util/string.ts';\nimport { compareChangelogFilePath } from '../common.ts';\nimport type {\n ChangeLogFile,\n ChangeLogNotes,\n ChangeLogProject,\n ChangeLogRelease,\n} from '../types.ts';\n\nexport const id = 'forgejo-changelog';\nconst http = new ForgejoHttp(id);\n\nexport async function getReleaseNotesMd(\n repository: string,\n apiBaseUrl: string,\n sourceDirectory?: string,\n): Promise<ChangeLogFile | null> {\n logger.trace('forgejo.getReleaseNotesMd()');\n const apiPrefix = `${apiBaseUrl}repos/${repository}/contents`;\n\n const sourceDir = sourceDirectory ? `/${sourceDirectory}` : '';\n const tree = (\n await http.getJson(\n `${apiPrefix}${sourceDir}`,\n {\n paginate: false, // no pagination yet\n },\n ContentsListResponse,\n )\n ).body;\n const allFiles = tree.filter((f) => f.type === 'file');\n let files: RepoContents[] = [];\n if (!files.length) {\n files = allFiles.filter((f) => changelogFilenameRegex.test(f.name));\n }\n if (!files.length) {\n logger.trace('no changelog file found');\n return null;\n }\n\n const { path: changelogFile } = files\n .sort((a, b) => compareChangelogFilePath(a.path, b.path))\n .shift()!;\n /* istanbul ignore if */\n if (files.length !== 0) {\n logger.debug(\n `Multiple candidates for changelog file, using ${changelogFile}`,\n );\n }\n\n const fileRes = await http.getJson(\n `${apiPrefix}/${changelogFile}`,\n RepoContents,\n );\n // istanbul ignore if: should never happen\n if (fileRes.body.type !== 'file' || !fileRes.body.content) {\n logger.debug(`Missing content for changelog file, using ${changelogFile}`);\n return null;\n }\n const changelogMd = `${fromBase64(fileRes.body.content)}\\n#\\n##`;\n\n return { changelogFile, changelogMd };\n}\n\nexport async function getReleaseList(\n project: ChangeLogProject,\n _release: ChangeLogRelease,\n): Promise<ChangeLogNotes[]> {\n logger.trace('forgejo.getReleaseNotesMd()');\n const apiUrl = `${project.apiBaseUrl}repos/${project.repository}/releases`;\n\n const res = await http.getJson(\n `${apiUrl}?draft=false`,\n {\n paginate: true,\n },\n Releases,\n );\n return res.body.map((release) => ({\n url: `${project.baseUrl}${project.repository}/releases/tag/${release.tag_name}`,\n notesSourceUrl: apiUrl,\n name: release.name,\n body: release.body,\n tag: release.tag_name,\n }));\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,KAAK;AAClB,MAAM,OAAO,IAAI,YAAY,EAAE;AAE/B,eAAsB,kBACpB,YACA,YACA,iBAC+B;CAC/B,OAAO,MAAM,6BAA6B;CAC1C,MAAM,YAAY,GAAG,WAAW,QAAQ,WAAW;CAEnD,MAAM,YAAY,kBAAkB,IAAI,oBAAoB;CAU5D,MAAM,YARJ,MAAM,KAAK,QACT,GAAG,YAAY,aACf,EACE,UAAU,MACZ,GACA,oBACF,EAAA,CACA,KACoB,QAAQ,MAAM,EAAE,SAAS,MAAM;CACrD,IAAI,QAAwB,CAAC;CAC7B,IAAI,CAAC,MAAM,QACT,QAAQ,SAAS,QAAQ,MAAM,uBAAuB,KAAK,EAAE,IAAI,CAAC;CAEpE,IAAI,CAAC,MAAM,QAAQ;EACjB,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,MAAM,EAAE,MAAM,kBAAkB,MAC7B,MAAM,GAAG,MAAM,yBAAyB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CACxD,MAAM;;CAET,IAAI,MAAM,WAAW,GACnB,OAAO,MACL,iDAAiD,eACnD;CAGF,MAAM,UAAU,MAAM,KAAK,QACzB,GAAG,UAAU,GAAG,iBAChB,YACF;;CAEA,IAAI,QAAQ,KAAK,SAAS,UAAU,CAAC,QAAQ,KAAK,SAAS;EACzD,OAAO,MAAM,6CAA6C,eAAe;EACzE,OAAO;CACT;CAGA,OAAO;EAAE;EAAe,aAAA,GAFD,WAAW,QAAQ,KAAK,OAAO,EAAE;CAEpB;AACtC;AAEA,eAAsB,eACpB,SACA,UAC2B;CAC3B,OAAO,MAAM,6BAA6B;CAC1C,MAAM,SAAS,GAAG,QAAQ,WAAW,QAAQ,QAAQ,WAAW;CAShE,QAAO,MAPW,KAAK,QACrB,GAAG,OAAO,eACV,EACE,UAAU,KACZ,GACA,QACF,EAAA,CACW,KAAK,KAAK,aAAa;EAChC,KAAK,GAAG,QAAQ,UAAU,QAAQ,WAAW,gBAAgB,QAAQ;EACrE,gBAAgB;EAChB,MAAM,QAAQ;EACd,MAAM,QAAQ;EACd,KAAK,QAAQ;CACf,EAAE;AACJ"}
|
|
@@ -2,8 +2,8 @@ import { fromBase64 } from "../../../../../../util/string.js";
|
|
|
2
2
|
import { logger } from "../../../../../../logger/index.js";
|
|
3
3
|
import { GiteaHttp } from "../../../../../../util/http/gitea.js";
|
|
4
4
|
import { Releases } from "../../../../../../modules/datasource/gitea-releases/schema.js";
|
|
5
|
+
import { ContentsListResponse, RepoContents } from "../../../../../../modules/platform/gitea/schema.js";
|
|
5
6
|
import { compareChangelogFilePath } from "../common.js";
|
|
6
|
-
import { ContentsListResponse, ContentsResponse } from "../../../../../../modules/platform/gitea/schema.js";
|
|
7
7
|
import changelogFilenameRegex from "changelog-filename-regex";
|
|
8
8
|
//#region lib/workers/repository/update/pr/changelog/gitea/index.ts
|
|
9
9
|
const id = "gitea-changelog";
|
|
@@ -22,9 +22,9 @@ async function getReleaseNotesMd(repository, apiBaseUrl, sourceDirectory) {
|
|
|
22
22
|
const { path: changelogFile } = files.sort((a, b) => compareChangelogFilePath(a.path, b.path)).shift();
|
|
23
23
|
/* istanbul ignore if */
|
|
24
24
|
if (files.length !== 0) logger.debug(`Multiple candidates for changelog file, using ${changelogFile}`);
|
|
25
|
-
const fileRes = await http.getJson(`${apiPrefix}/${changelogFile}`,
|
|
25
|
+
const fileRes = await http.getJson(`${apiPrefix}/${changelogFile}`, RepoContents);
|
|
26
26
|
// istanbul ignore if: should never happen
|
|
27
|
-
if (!fileRes.body.content) {
|
|
27
|
+
if (fileRes.body.type !== "file" || !fileRes.body.content) {
|
|
28
28
|
logger.debug(`Missing content for changelog file, using ${changelogFile}`);
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../lib/workers/repository/update/pr/changelog/gitea/index.ts"],"sourcesContent":["import changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../../../../logger/index.ts';\nimport { Releases } from '../../../../../../modules/datasource/gitea-releases/schema.ts';\nimport {\n ContentsListResponse,\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../lib/workers/repository/update/pr/changelog/gitea/index.ts"],"sourcesContent":["import changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../../../../logger/index.ts';\nimport { Releases } from '../../../../../../modules/datasource/gitea-releases/schema.ts';\nimport {\n ContentsListResponse,\n RepoContents,\n} from '../../../../../../modules/platform/gitea/schema.ts';\nimport { GiteaHttp } from '../../../../../../util/http/gitea.ts';\nimport { fromBase64 } from '../../../../../../util/string.ts';\nimport { compareChangelogFilePath } from '../common.ts';\nimport type {\n ChangeLogFile,\n ChangeLogNotes,\n ChangeLogProject,\n ChangeLogRelease,\n} from '../types.ts';\n\nexport const id = 'gitea-changelog';\nconst http = new GiteaHttp(id);\n\nexport async function getReleaseNotesMd(\n repository: string,\n apiBaseUrl: string,\n sourceDirectory?: string,\n): Promise<ChangeLogFile | null> {\n logger.trace('gitea.getReleaseNotesMd()');\n const apiPrefix = `${apiBaseUrl}repos/${repository}/contents`;\n\n const sourceDir = sourceDirectory ? `/${sourceDirectory}` : '';\n const tree = (\n await http.getJson(\n `${apiPrefix}${sourceDir}`,\n {\n paginate: false, // no pagination yet\n },\n ContentsListResponse,\n )\n ).body;\n const allFiles = tree.filter((f) => f.type === 'file');\n let files: RepoContents[] = [];\n if (!files.length) {\n files = allFiles.filter((f) => changelogFilenameRegex.test(f.name));\n }\n if (!files.length) {\n logger.trace('no changelog file found');\n return null;\n }\n\n const { path: changelogFile } = files\n .sort((a, b) => compareChangelogFilePath(a.path, b.path))\n .shift()!;\n /* istanbul ignore if */\n if (files.length !== 0) {\n logger.debug(\n `Multiple candidates for changelog file, using ${changelogFile}`,\n );\n }\n\n const fileRes = await http.getJson(\n `${apiPrefix}/${changelogFile}`,\n RepoContents,\n );\n // istanbul ignore if: should never happen\n if (fileRes.body.type !== 'file' || !fileRes.body.content) {\n logger.debug(`Missing content for changelog file, using ${changelogFile}`);\n return null;\n }\n const changelogMd = `${fromBase64(fileRes.body.content)}\\n#\\n##`;\n\n return { changelogFile, changelogMd };\n}\n\nexport async function getReleaseList(\n project: ChangeLogProject,\n _release: ChangeLogRelease,\n): Promise<ChangeLogNotes[]> {\n logger.trace('gitea.getReleaseNotesMd()');\n const apiUrl = `${project.apiBaseUrl}repos/${project.repository}/releases`;\n\n const res = await http.getJson(\n `${apiUrl}?draft=false`,\n {\n paginate: true,\n },\n Releases,\n );\n return res.body.map((release) => ({\n url: `${project.baseUrl}${project.repository}/releases/tag/${release.tag_name}`,\n notesSourceUrl: apiUrl,\n name: release.name,\n body: release.body,\n tag: release.tag_name,\n }));\n}\n"],"mappings":";;;;;;;;AAiBA,MAAa,KAAK;AAClB,MAAM,OAAO,IAAI,UAAU,EAAE;AAE7B,eAAsB,kBACpB,YACA,YACA,iBAC+B;CAC/B,OAAO,MAAM,2BAA2B;CACxC,MAAM,YAAY,GAAG,WAAW,QAAQ,WAAW;CAEnD,MAAM,YAAY,kBAAkB,IAAI,oBAAoB;CAU5D,MAAM,YARJ,MAAM,KAAK,QACT,GAAG,YAAY,aACf,EACE,UAAU,MACZ,GACA,oBACF,EAAA,CACA,KACoB,QAAQ,MAAM,EAAE,SAAS,MAAM;CACrD,IAAI,QAAwB,CAAC;CAC7B,IAAI,CAAC,MAAM,QACT,QAAQ,SAAS,QAAQ,MAAM,uBAAuB,KAAK,EAAE,IAAI,CAAC;CAEpE,IAAI,CAAC,MAAM,QAAQ;EACjB,OAAO,MAAM,yBAAyB;EACtC,OAAO;CACT;CAEA,MAAM,EAAE,MAAM,kBAAkB,MAC7B,MAAM,GAAG,MAAM,yBAAyB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CACxD,MAAM;;CAET,IAAI,MAAM,WAAW,GACnB,OAAO,MACL,iDAAiD,eACnD;CAGF,MAAM,UAAU,MAAM,KAAK,QACzB,GAAG,UAAU,GAAG,iBAChB,YACF;;CAEA,IAAI,QAAQ,KAAK,SAAS,UAAU,CAAC,QAAQ,KAAK,SAAS;EACzD,OAAO,MAAM,6CAA6C,eAAe;EACzE,OAAO;CACT;CAGA,OAAO;EAAE;EAAe,aAAA,GAFD,WAAW,QAAQ,KAAK,OAAO,EAAE;CAEpB;AACtC;AAEA,eAAsB,eACpB,SACA,UAC2B;CAC3B,OAAO,MAAM,2BAA2B;CACxC,MAAM,SAAS,GAAG,QAAQ,WAAW,QAAQ,QAAQ,WAAW;CAShE,QAAO,MAPW,KAAK,QACrB,GAAG,OAAO,eACV,EACE,UAAU,KACZ,GACA,QACF,EAAA,CACW,KAAK,KAAK,aAAa;EAChC,KAAK,GAAG,QAAQ,UAAU,QAAQ,WAAW,gBAAgB,QAAQ;EACrE,gBAAgB;EAChB,MAAM,QAAQ;EACd,MAAM,QAAQ;EACd,KAAK,QAAQ;CACf,EAAE;AACJ"}
|
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.
|
|
3
|
+
"title": "JSON schema for Renovate 44.85.1 config files (https://renovatebot.com/)",
|
|
4
4
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"x-renovate-version": "44.
|
|
5
|
+
"x-renovate-version": "44.85.1",
|
|
6
6
|
"allowComments": true,
|
|
7
7
|
"type": "object",
|
|
8
8
|
"definitions": {
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { logger } from "../../../logger/index.js";
|
|
2
|
-
import { getQueryString } from "../../../util/url.js";
|
|
3
|
-
import { getCache } from "../../../util/cache/repository/index.js";
|
|
4
|
-
import { ForgejoHttp } from "../../../util/http/forgejo.js";
|
|
5
|
-
import { Comment, CommitStatus, Issue, Label, PR, Repo, RepoContents, RepoSearchResults, User, Version } from "./schema.js";
|
|
6
|
-
import { API_PATH } from "./utils.js";
|
|
7
|
-
import { isBoolean } from "@sindresorhus/is";
|
|
8
|
-
import { z } from "zod/v4";
|
|
9
|
-
//#region lib/modules/platform/forgejo/forgejo-helper.ts
|
|
10
|
-
const forgejoHttp = new ForgejoHttp();
|
|
11
|
-
function urlEscape(raw) {
|
|
12
|
-
return encodeURIComponent(raw);
|
|
13
|
-
}
|
|
14
|
-
const commitStatusStates = [
|
|
15
|
-
"unknown",
|
|
16
|
-
"success",
|
|
17
|
-
"pending",
|
|
18
|
-
"warning",
|
|
19
|
-
"failure",
|
|
20
|
-
"error"
|
|
21
|
-
];
|
|
22
|
-
async function getCurrentUser(options = {}) {
|
|
23
|
-
const url = `${API_PATH}/user`;
|
|
24
|
-
return (await forgejoHttp.getJson(url, options, User)).body;
|
|
25
|
-
}
|
|
26
|
-
async function getVersion(options = {}) {
|
|
27
|
-
const url = `${API_PATH}/version`;
|
|
28
|
-
return (await forgejoHttp.getJson(url, options, Version)).body.version;
|
|
29
|
-
}
|
|
30
|
-
async function isOrg(organization) {
|
|
31
|
-
const repoCache = getCache();
|
|
32
|
-
repoCache.platform ??= {};
|
|
33
|
-
repoCache.platform.forgejo ??= {};
|
|
34
|
-
repoCache.platform.forgejo.orgs ??= {};
|
|
35
|
-
const cached = repoCache.platform.forgejo.orgs[organization];
|
|
36
|
-
if (isBoolean(cached)) return cached;
|
|
37
|
-
try {
|
|
38
|
-
const url = `${API_PATH}/orgs/${organization}`;
|
|
39
|
-
const res = await forgejoHttp.getJsonUnchecked(url);
|
|
40
|
-
repoCache.platform.forgejo.orgs[organization] = res.statusCode === 200;
|
|
41
|
-
return res.statusCode === 200;
|
|
42
|
-
} catch (err) {
|
|
43
|
-
if (err.statusCode === 404) return false;
|
|
44
|
-
throw err;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async function searchRepos(params, options) {
|
|
48
|
-
const query = getQueryString(params);
|
|
49
|
-
const url = `${API_PATH}/repos/search?${query}`;
|
|
50
|
-
const res = await forgejoHttp.getJson(url, {
|
|
51
|
-
...options,
|
|
52
|
-
paginate: true
|
|
53
|
-
}, RepoSearchResults);
|
|
54
|
-
if (!res.body.ok) throw new Error("Unable to search for repositories, ok flag has not been set");
|
|
55
|
-
return res.body.data;
|
|
56
|
-
}
|
|
57
|
-
async function orgListRepos(organization, options) {
|
|
58
|
-
const url = `${API_PATH}/orgs/${organization}/repos`;
|
|
59
|
-
return (await forgejoHttp.getJson(url, {
|
|
60
|
-
...options,
|
|
61
|
-
paginate: true
|
|
62
|
-
}, z.array(Repo))).body;
|
|
63
|
-
}
|
|
64
|
-
async function getRepo(repoPath, options = {}) {
|
|
65
|
-
const url = `${API_PATH}/repos/${repoPath}`;
|
|
66
|
-
return (await forgejoHttp.getJson(url, options, Repo)).body;
|
|
67
|
-
}
|
|
68
|
-
async function getRepoContents(repoPath, filePath, ref, options = {}) {
|
|
69
|
-
const query = getQueryString(ref ? { ref } : {});
|
|
70
|
-
const url = `${API_PATH}/repos/${repoPath}/contents/${urlEscape(filePath)}?${query}`;
|
|
71
|
-
return (await forgejoHttp.getJson(url, options, RepoContents)).body;
|
|
72
|
-
}
|
|
73
|
-
async function createPR(repoPath, params, options) {
|
|
74
|
-
const url = `${API_PATH}/repos/${repoPath}/pulls`;
|
|
75
|
-
return (await forgejoHttp.postJson(url, {
|
|
76
|
-
...options,
|
|
77
|
-
body: params
|
|
78
|
-
}, PR)).body;
|
|
79
|
-
}
|
|
80
|
-
async function updatePR(repoPath, idx, params, options) {
|
|
81
|
-
const url = `${API_PATH}/repos/${repoPath}/pulls/${idx}`;
|
|
82
|
-
return (await forgejoHttp.patchJson(url, {
|
|
83
|
-
...options,
|
|
84
|
-
body: params
|
|
85
|
-
}, PR)).body;
|
|
86
|
-
}
|
|
87
|
-
async function mergePR(repoPath, idx, params, options) {
|
|
88
|
-
const url = `${API_PATH}/repos/${repoPath}/pulls/${idx}/merge`;
|
|
89
|
-
await forgejoHttp.postJson(url, {
|
|
90
|
-
...options,
|
|
91
|
-
body: params
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
async function getPR(repoPath, idx, options = {}) {
|
|
95
|
-
const url = `${API_PATH}/repos/${repoPath}/pulls/${idx}`;
|
|
96
|
-
return (await forgejoHttp.getJson(url, options, PR)).body;
|
|
97
|
-
}
|
|
98
|
-
async function getPRByBranch(repoPath, base, head, options = {}) {
|
|
99
|
-
const url = `${API_PATH}/repos/${repoPath}/pulls/${base}/${head}`;
|
|
100
|
-
try {
|
|
101
|
-
return (await forgejoHttp.getJson(url, options, PR)).body;
|
|
102
|
-
} catch (err) {
|
|
103
|
-
logger.trace({ err }, "Error while fetching PR");
|
|
104
|
-
if (err.statusCode !== 404) logger.debug({ err }, "Error while fetching PR");
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async function requestPrReviewers(repoPath, idx, params, options) {
|
|
109
|
-
const url = `${API_PATH}/repos/${repoPath}/pulls/${idx}/requested_reviewers`;
|
|
110
|
-
await forgejoHttp.postJson(url, {
|
|
111
|
-
...options,
|
|
112
|
-
body: params
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
async function createIssue(repoPath, params, options) {
|
|
116
|
-
const url = `${API_PATH}/repos/${repoPath}/issues`;
|
|
117
|
-
return (await forgejoHttp.postJson(url, {
|
|
118
|
-
...options,
|
|
119
|
-
body: params
|
|
120
|
-
}, Issue)).body;
|
|
121
|
-
}
|
|
122
|
-
async function updateIssue(repoPath, idx, params, options) {
|
|
123
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/${idx}`;
|
|
124
|
-
return (await forgejoHttp.patchJson(url, {
|
|
125
|
-
...options,
|
|
126
|
-
body: params
|
|
127
|
-
}, Issue)).body;
|
|
128
|
-
}
|
|
129
|
-
async function updateIssueLabels(repoPath, idx, params, options) {
|
|
130
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/${idx}/labels`;
|
|
131
|
-
return (await forgejoHttp.putJson(url, {
|
|
132
|
-
...options,
|
|
133
|
-
body: params
|
|
134
|
-
}, z.array(Label))).body;
|
|
135
|
-
}
|
|
136
|
-
async function closeIssue(repoPath, idx, options) {
|
|
137
|
-
await updateIssue(repoPath, idx, {
|
|
138
|
-
...options,
|
|
139
|
-
state: "closed"
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
async function searchIssues(repoPath, params, options) {
|
|
143
|
-
const query = getQueryString({
|
|
144
|
-
...params,
|
|
145
|
-
type: "issues"
|
|
146
|
-
});
|
|
147
|
-
const url = `${API_PATH}/repos/${repoPath}/issues?${query}`;
|
|
148
|
-
return (await forgejoHttp.getJson(url, {
|
|
149
|
-
...options,
|
|
150
|
-
paginate: true
|
|
151
|
-
}, z.array(Issue))).body;
|
|
152
|
-
}
|
|
153
|
-
async function getIssue(repoPath, idx, options = {}) {
|
|
154
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/${idx}`;
|
|
155
|
-
return (await forgejoHttp.getJson(url, options, Issue)).body;
|
|
156
|
-
}
|
|
157
|
-
async function getRepoLabels(repoPath, options = {}) {
|
|
158
|
-
const url = `${API_PATH}/repos/${repoPath}/labels`;
|
|
159
|
-
return (await forgejoHttp.getJson(url, options, z.array(Label))).body;
|
|
160
|
-
}
|
|
161
|
-
async function getOrgLabels(orgName, options = {}) {
|
|
162
|
-
const url = `${API_PATH}/orgs/${orgName}/labels`;
|
|
163
|
-
return (await forgejoHttp.getJson(url, options, z.array(Label))).body;
|
|
164
|
-
}
|
|
165
|
-
async function unassignLabel(repoPath, issue, label, options) {
|
|
166
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/${issue}/labels/${label}`;
|
|
167
|
-
await forgejoHttp.deleteJson(url, options);
|
|
168
|
-
}
|
|
169
|
-
async function createComment(repoPath, issue, body, options) {
|
|
170
|
-
const params = { body };
|
|
171
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/${issue}/comments`;
|
|
172
|
-
return (await forgejoHttp.postJson(url, {
|
|
173
|
-
...options,
|
|
174
|
-
body: params
|
|
175
|
-
}, Comment)).body;
|
|
176
|
-
}
|
|
177
|
-
async function updateComment(repoPath, idx, body, options) {
|
|
178
|
-
const params = { body };
|
|
179
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/comments/${idx}`;
|
|
180
|
-
return (await forgejoHttp.patchJson(url, {
|
|
181
|
-
...options,
|
|
182
|
-
body: params
|
|
183
|
-
}, Comment)).body;
|
|
184
|
-
}
|
|
185
|
-
async function deleteComment(repoPath, idx, options) {
|
|
186
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/comments/${idx}`;
|
|
187
|
-
await forgejoHttp.deleteJson(url, options);
|
|
188
|
-
}
|
|
189
|
-
async function getComments(repoPath, issue, options = {}) {
|
|
190
|
-
const url = `${API_PATH}/repos/${repoPath}/issues/${issue}/comments`;
|
|
191
|
-
return (await forgejoHttp.getJson(url, options, z.array(Comment))).body;
|
|
192
|
-
}
|
|
193
|
-
async function createCommitStatus(repoPath, branchCommit, params, options) {
|
|
194
|
-
const url = `${API_PATH}/repos/${repoPath}/statuses/${branchCommit}`;
|
|
195
|
-
return (await forgejoHttp.postJson(url, {
|
|
196
|
-
...options,
|
|
197
|
-
body: params
|
|
198
|
-
}, CommitStatus)).body;
|
|
199
|
-
}
|
|
200
|
-
const forgejoToRenovateStatusMapping = {
|
|
201
|
-
unknown: "yellow",
|
|
202
|
-
success: "green",
|
|
203
|
-
pending: "yellow",
|
|
204
|
-
warning: "red",
|
|
205
|
-
failure: "red",
|
|
206
|
-
error: "red"
|
|
207
|
-
};
|
|
208
|
-
const renovateToForgejoStatusMapping = {
|
|
209
|
-
green: "success",
|
|
210
|
-
yellow: "pending",
|
|
211
|
-
red: "failure"
|
|
212
|
-
};
|
|
213
|
-
function filterStatus(data) {
|
|
214
|
-
const ret = {};
|
|
215
|
-
for (const i of data) if (!ret[i.context] || ret[i.context].id < i.id) ret[i.context] = i;
|
|
216
|
-
return Object.values(ret);
|
|
217
|
-
}
|
|
218
|
-
async function getCombinedCommitStatus(repoPath, branchName, options) {
|
|
219
|
-
const url = `${API_PATH}/repos/${repoPath}/commits/${urlEscape(branchName)}/statuses`;
|
|
220
|
-
const res = await forgejoHttp.getJson(url, {
|
|
221
|
-
...options,
|
|
222
|
-
paginate: true
|
|
223
|
-
}, z.array(CommitStatus));
|
|
224
|
-
let worstState = 0;
|
|
225
|
-
const statuses = filterStatus(res.body);
|
|
226
|
-
for (const cs of statuses) worstState = Math.max(worstState, commitStatusStates.indexOf(cs.status));
|
|
227
|
-
return {
|
|
228
|
-
worstStatus: commitStatusStates[worstState],
|
|
229
|
-
statuses
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
//#endregion
|
|
233
|
-
export { closeIssue, createComment, createCommitStatus, createIssue, createPR, deleteComment, forgejoHttp, forgejoToRenovateStatusMapping, getCombinedCommitStatus, getComments, getCurrentUser, getIssue, getOrgLabels, getPR, getPRByBranch, getRepo, getRepoContents, getRepoLabels, getVersion, isOrg, mergePR, orgListRepos, renovateToForgejoStatusMapping, requestPrReviewers, searchIssues, searchRepos, unassignLabel, updateComment, updateIssue, updateIssueLabels, updatePR };
|
|
234
|
-
|
|
235
|
-
//# sourceMappingURL=forgejo-helper.js.map
|