renovate 44.30.0 → 44.30.2
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/migration.js +3 -3
- package/dist/config/migration.js.map +1 -1
- package/dist/config/migrations/custom/azure-gitlab-automerge-migration.js.map +1 -1
- package/dist/config/migrations/custom/dep-types-migration.js.map +1 -1
- package/dist/config/options/env.js +2 -1
- package/dist/config/options/env.js.map +1 -1
- package/dist/config/options/index.js +1 -1
- package/dist/config/options/index.js.map +1 -1
- package/dist/global-config-option-defaults.generated.js +1 -1
- package/dist/global-config-option-defaults.generated.js.map +1 -1
- package/dist/logger/utils.js +3 -3
- package/dist/logger/utils.js.map +1 -1
- package/dist/modules/datasource/crate/index.js +3 -3
- package/dist/modules/datasource/crate/index.js.map +1 -1
- package/dist/modules/datasource/go/base.js +1 -1
- package/dist/modules/datasource/go/base.js.map +1 -1
- package/dist/modules/datasource/go/goproxy-parser.js +1 -1
- package/dist/modules/datasource/go/goproxy-parser.js.map +1 -1
- package/dist/modules/datasource/hexpm-bob/index.js +3 -3
- package/dist/modules/datasource/hexpm-bob/index.js.map +1 -1
- package/dist/modules/datasource/maven/util.js +1 -1
- package/dist/modules/datasource/maven/util.js.map +1 -1
- package/dist/modules/datasource/packagist/schema.js +2 -1
- package/dist/modules/datasource/packagist/schema.js.map +1 -1
- package/dist/modules/datasource/pypi/common.js +1 -1
- package/dist/modules/datasource/pypi/common.js.map +1 -1
- package/dist/modules/datasource/rpm/repomd.js +2 -1
- package/dist/modules/datasource/rpm/repomd.js.map +1 -1
- package/dist/modules/datasource/sbt-package/util.js +3 -3
- package/dist/modules/datasource/sbt-package/util.js.map +1 -1
- package/dist/modules/datasource/terraform-provider/index.js +1 -1
- package/dist/modules/datasource/terraform-provider/index.js.map +1 -1
- package/dist/modules/manager/ansible-galaxy/util.js +4 -4
- package/dist/modules/manager/ansible-galaxy/util.js.map +1 -1
- package/dist/modules/manager/asdf/upgradeable-tooling.js +5 -5
- package/dist/modules/manager/asdf/upgradeable-tooling.js.map +1 -1
- package/dist/modules/manager/bazel-module/extract.js +2 -1
- package/dist/modules/manager/bazel-module/extract.js.map +1 -1
- package/dist/modules/manager/bazel-module/parser/repo-rules.js +1 -1
- package/dist/modules/manager/bazel-module/parser/repo-rules.js.map +1 -1
- package/dist/modules/manager/bitbucket-pipelines/extract.js +2 -2
- package/dist/modules/manager/bitbucket-pipelines/extract.js.map +1 -1
- package/dist/modules/manager/bun/utils.js +2 -1
- package/dist/modules/manager/bun/utils.js.map +1 -1
- package/dist/modules/manager/bundler/extract.js +1 -1
- package/dist/modules/manager/bundler/extract.js.map +1 -1
- package/dist/modules/manager/cake/index.js.map +1 -1
- package/dist/modules/manager/composer/schema.js +2 -2
- package/dist/modules/manager/composer/schema.js.map +1 -1
- package/dist/modules/manager/cpanfile/language.js.map +1 -1
- package/dist/modules/manager/cpanfile/parser.js +4 -4
- package/dist/modules/manager/cpanfile/parser.js.map +1 -1
- package/dist/modules/manager/crossplane/extract.js +2 -1
- package/dist/modules/manager/crossplane/extract.js.map +1 -1
- package/dist/modules/manager/deps-edn/extract.js +1 -1
- package/dist/modules/manager/deps-edn/extract.js.map +1 -1
- package/dist/modules/manager/deps-edn/parser.js.map +1 -1
- package/dist/modules/manager/dockerfile/extract.js +2 -2
- package/dist/modules/manager/dockerfile/extract.js.map +1 -1
- package/dist/modules/manager/flux/extract.js +2 -2
- package/dist/modules/manager/flux/extract.js.map +1 -1
- package/dist/modules/manager/git-submodules/extract.js +1 -1
- package/dist/modules/manager/git-submodules/extract.js.map +1 -1
- package/dist/modules/manager/gomod/artifacts.js +1 -1
- package/dist/modules/manager/gomod/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle/extract/consistent-versions-plugin.js +2 -2
- package/dist/modules/manager/gradle/extract/consistent-versions-plugin.js.map +1 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js +2 -2
- package/dist/modules/manager/gradle-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/helmv3/utils.js +2 -1
- package/dist/modules/manager/helmv3/utils.js.map +1 -1
- package/dist/modules/manager/hermit/extract.js +1 -1
- package/dist/modules/manager/hermit/extract.js.map +1 -1
- package/dist/modules/manager/homebrew/utils.js +3 -3
- package/dist/modules/manager/homebrew/utils.js.map +1 -1
- package/dist/modules/manager/jsonnet-bundler/extract.js +2 -1
- package/dist/modules/manager/jsonnet-bundler/extract.js.map +1 -1
- package/dist/modules/manager/leiningen/extract.js +2 -2
- package/dist/modules/manager/leiningen/extract.js.map +1 -1
- package/dist/modules/manager/maven-wrapper/artifacts.js +6 -6
- package/dist/modules/manager/maven-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/mise/backends.js +3 -3
- package/dist/modules/manager/mise/backends.js.map +1 -1
- package/dist/modules/manager/mise/upgradeable-tooling.js +1 -1
- package/dist/modules/manager/mise/upgradeable-tooling.js.map +1 -1
- package/dist/modules/manager/npm/extract/common/dependency.js +2 -2
- package/dist/modules/manager/npm/extract/common/dependency.js.map +1 -1
- package/dist/modules/manager/npm/extract/post/locked-versions.js +2 -1
- package/dist/modules/manager/npm/extract/post/locked-versions.js.map +1 -1
- package/dist/modules/manager/npm/post-update/index.js +1 -1
- package/dist/modules/manager/npm/post-update/index.js.map +1 -1
- package/dist/modules/manager/npm/post-update/npm.js +2 -1
- package/dist/modules/manager/npm/post-update/npm.js.map +1 -1
- package/dist/modules/manager/npm/post-update/yarn.js +2 -2
- package/dist/modules/manager/npm/post-update/yarn.js.map +1 -1
- package/dist/modules/manager/npm/schema.js +2 -1
- package/dist/modules/manager/npm/schema.js.map +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/get-locked.js +2 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/get-locked.js.map +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/replace.js +1 -1
- package/dist/modules/manager/npm/update/locked-dependency/yarn-lock/replace.js.map +1 -1
- package/dist/modules/manager/nuget/extract.js +1 -1
- package/dist/modules/manager/nuget/extract.js.map +1 -1
- package/dist/modules/manager/nvm/extract.js +2 -1
- package/dist/modules/manager/nvm/extract.js.map +1 -1
- package/dist/modules/manager/osgi/extract.js +2 -1
- package/dist/modules/manager/osgi/extract.js.map +1 -1
- package/dist/modules/manager/pep621/processors/uv.js +2 -1
- package/dist/modules/manager/pep621/processors/uv.js.map +1 -1
- package/dist/modules/manager/pip_requirements/extract.js +1 -1
- package/dist/modules/manager/pip_requirements/extract.js.map +1 -1
- package/dist/modules/manager/pip_setup/extract.js +3 -3
- package/dist/modules/manager/pip_setup/extract.js.map +1 -1
- package/dist/modules/manager/pixi/schema.js +2 -1
- package/dist/modules/manager/pixi/schema.js.map +1 -1
- package/dist/modules/manager/setup-cfg/extract.js +1 -1
- package/dist/modules/manager/setup-cfg/extract.js.map +1 -1
- package/dist/modules/manager/sveltos/util.js +1 -1
- package/dist/modules/manager/sveltos/util.js.map +1 -1
- package/dist/modules/manager/typst/extract.js +2 -2
- package/dist/modules/manager/typst/extract.js.map +1 -1
- package/dist/modules/platform/azure/issue.js +2 -1
- package/dist/modules/platform/azure/issue.js.map +1 -1
- package/dist/modules/platform/bitbucket/index.js +1 -1
- package/dist/modules/platform/bitbucket/index.js.map +1 -1
- package/dist/modules/platform/bitbucket/schema.js +2 -1
- package/dist/modules/platform/bitbucket/schema.js.map +1 -1
- package/dist/modules/platform/codecommit/codecommit-client.js +2 -1
- package/dist/modules/platform/codecommit/codecommit-client.js.map +1 -1
- package/dist/modules/platform/gerrit/utils.js +1 -1
- package/dist/modules/platform/gerrit/utils.js.map +1 -1
- package/dist/modules/platform/github/index.js +8 -8
- package/dist/modules/platform/github/index.js.map +1 -1
- package/dist/modules/platform/github/massage-markdown-links.js +6 -3
- package/dist/modules/platform/github/massage-markdown-links.js.map +1 -1
- package/dist/modules/versioning/apk/index.js +15 -15
- package/dist/modules/versioning/apk/index.js.map +1 -1
- package/dist/modules/versioning/bazel-module/bzlmod-version.js +3 -2
- package/dist/modules/versioning/bazel-module/bzlmod-version.js.map +1 -1
- package/dist/modules/versioning/bazel-module/index.js +2 -1
- package/dist/modules/versioning/bazel-module/index.js.map +1 -1
- package/dist/modules/versioning/composer/index.js +2 -2
- package/dist/modules/versioning/composer/index.js.map +1 -1
- package/dist/modules/versioning/conan/range.js +4 -3
- package/dist/modules/versioning/conan/range.js.map +1 -1
- package/dist/modules/versioning/conda/index.js +4 -3
- package/dist/modules/versioning/conda/index.js.map +1 -1
- package/dist/modules/versioning/distro.js +2 -1
- package/dist/modules/versioning/distro.js.map +1 -1
- package/dist/modules/versioning/generic.js +2 -1
- package/dist/modules/versioning/generic.js.map +1 -1
- package/dist/modules/versioning/hashicorp/convertor.js +1 -1
- package/dist/modules/versioning/hashicorp/convertor.js.map +1 -1
- package/dist/modules/versioning/npm/range.js +1 -1
- package/dist/modules/versioning/npm/range.js.map +1 -1
- package/dist/modules/versioning/nuget/range.js +2 -1
- package/dist/modules/versioning/nuget/range.js.map +1 -1
- package/dist/modules/versioning/perl/index.js +1 -1
- package/dist/modules/versioning/perl/index.js.map +1 -1
- package/dist/modules/versioning/poetry/transform.js +2 -2
- package/dist/modules/versioning/poetry/transform.js.map +1 -1
- package/dist/modules/versioning/rez/pattern.js.map +1 -1
- package/dist/modules/versioning/ruby/index.js +1 -1
- package/dist/modules/versioning/ruby/index.js.map +1 -1
- package/dist/modules/versioning/semver/index.js +2 -1
- package/dist/modules/versioning/semver/index.js.map +1 -1
- package/dist/modules/versioning/semver-coerced/index.js +1 -1
- package/dist/modules/versioning/semver-coerced/index.js.map +1 -1
- package/dist/util/emoji.js.map +1 -1
- package/dist/util/exec/containerbase.js +2 -1
- package/dist/util/exec/containerbase.js.map +1 -1
- package/dist/util/exec/env.js +2 -1
- package/dist/util/exec/env.js.map +1 -1
- package/dist/util/git/private-key.js +1 -1
- package/dist/util/git/private-key.js.map +1 -1
- package/dist/util/github/graphql/datasource-fetcher.js +2 -1
- package/dist/util/github/graphql/datasource-fetcher.js.map +1 -1
- package/dist/util/http/forgejo.js +2 -1
- package/dist/util/http/forgejo.js.map +1 -1
- package/dist/util/http/gitea.js +2 -1
- package/dist/util/http/gitea.js.map +1 -1
- package/dist/util/number.js +2 -1
- package/dist/util/number.js.map +1 -1
- package/dist/util/string-match.js +1 -1
- package/dist/util/string-match.js.map +1 -1
- package/dist/util/url.js +2 -2
- package/dist/util/url.js.map +1 -1
- package/dist/workers/global/config/parse/cli.js +1 -1
- package/dist/workers/global/config/parse/cli.js.map +1 -1
- package/dist/workers/global/config/parse/coersions.js +2 -1
- package/dist/workers/global/config/parse/coersions.js.map +1 -1
- package/dist/workers/global/config/parse/host-rules-from-env.js +2 -1
- package/dist/workers/global/config/parse/host-rules-from-env.js.map +1 -1
- package/dist/workers/repository/model/commit-message.js +2 -1
- package/dist/workers/repository/model/commit-message.js.map +1 -1
- package/dist/workers/repository/model/semantic-commit-message.js +2 -1
- package/dist/workers/repository/model/semantic-commit-message.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/common.js +1 -1
- package/dist/workers/repository/update/pr/changelog/common.js.map +1 -1
- package/dist/workers/repository/updates/generate.js +1 -1
- package/dist/workers/repository/updates/generate.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { REPOSITORY_UNINITIATED } from "../../../constants/error-messages.js";
|
|
2
2
|
import { getEnv } from "../../../util/env.js";
|
|
3
|
+
import { regEx } from "../../../util/regex.js";
|
|
3
4
|
import { logger } from "../../../logger/index.js";
|
|
4
5
|
import { isString } from "@sindresorhus/is";
|
|
5
6
|
import { CodeCommitClient, CreatePullRequestApprovalRuleCommand, CreatePullRequestCommand, DeleteCommentContentCommand, GetCommentsForPullRequestCommand, GetFileCommand, GetPullRequestCommand, GetRepositoryCommand, ListPullRequestsCommand, ListRepositoriesCommand, PostCommentForPullRequestCommand, PullRequestStatusEnum, UpdateCommentCommand, UpdatePullRequestDescriptionCommand, UpdatePullRequestStatusCommand, UpdatePullRequestTitleCommand } from "@aws-sdk/client-codecommit";
|
|
@@ -132,7 +133,7 @@ function getCodeCommitUrl(repoMetadata, repoName) {
|
|
|
132
133
|
const token = `${dateTime}Z${signer.signature()}`;
|
|
133
134
|
let username = `${env.AWS_ACCESS_KEY_ID}${env.AWS_SESSION_TOKEN ? `%${env.AWS_SESSION_TOKEN}` : ""}`;
|
|
134
135
|
/* v8 ignore next -- only hit when an AWS session token contains '/', not present in spec env */
|
|
135
|
-
if (username.includes("/")) username = username.replace(/\//g, "%2F");
|
|
136
|
+
if (username.includes("/")) username = username.replace(regEx(/\//g), "%2F");
|
|
136
137
|
return `https://${username}:${token}@git-codecommit.${env.AWS_REGION ?? "us-east-1"}.amazonaws.com/v1/repos/${repoName}`;
|
|
137
138
|
}
|
|
138
139
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecommit-client.js","names":[],"sources":["../../../../lib/modules/platform/codecommit/codecommit-client.ts"],"sourcesContent":["import type {\n CreatePullRequestApprovalRuleInput,\n CreatePullRequestApprovalRuleOutput,\n CreatePullRequestInput,\n CreatePullRequestOutput,\n DeleteCommentContentInput,\n DeleteCommentContentOutput,\n GetCommentsForPullRequestInput,\n GetCommentsForPullRequestOutput,\n GetFileInput,\n GetFileOutput,\n GetPullRequestInput,\n GetPullRequestOutput,\n GetRepositoryInput,\n GetRepositoryOutput,\n ListPullRequestsInput,\n ListPullRequestsOutput,\n ListRepositoriesInput,\n ListRepositoriesOutput,\n PostCommentForPullRequestInput,\n PostCommentForPullRequestOutput,\n RepositoryMetadata,\n UpdateCommentInput,\n UpdateCommentOutput,\n UpdatePullRequestDescriptionInput,\n UpdatePullRequestDescriptionOutput,\n UpdatePullRequestStatusInput,\n UpdatePullRequestStatusOutput,\n UpdatePullRequestTitleInput,\n UpdatePullRequestTitleOutput,\n} from '@aws-sdk/client-codecommit';\nimport {\n CodeCommitClient,\n CreatePullRequestApprovalRuleCommand,\n CreatePullRequestCommand,\n DeleteCommentContentCommand,\n GetCommentsForPullRequestCommand,\n GetFileCommand,\n GetPullRequestCommand,\n GetRepositoryCommand,\n ListPullRequestsCommand,\n ListRepositoriesCommand,\n PostCommentForPullRequestCommand,\n PullRequestStatusEnum,\n UpdateCommentCommand,\n UpdatePullRequestDescriptionCommand,\n UpdatePullRequestStatusCommand,\n UpdatePullRequestTitleCommand,\n} from '@aws-sdk/client-codecommit';\nimport { isString } from '@sindresorhus/is';\nimport * as aws4 from 'aws4';\nimport { REPOSITORY_UNINITIATED } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { getEnv } from '../../../util/env.ts';\n\nlet codeCommitClient: CodeCommitClient;\n\nexport function buildCodeCommitClient(): void {\n if (!codeCommitClient) {\n codeCommitClient = new CodeCommitClient({});\n }\n\n /* v8 ignore next -- unreachable: the client was just constructed above */\n if (!codeCommitClient) {\n throw new Error('Failed to initialize codecommit client');\n }\n}\n\nexport async function deleteComment(\n commentId: string,\n): Promise<DeleteCommentContentOutput> {\n const input: DeleteCommentContentInput = {\n commentId,\n };\n const cmd = new DeleteCommentContentCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getPrComments(\n pullRequestId: string,\n): Promise<GetCommentsForPullRequestOutput> {\n const input: GetCommentsForPullRequestInput = {\n pullRequestId,\n };\n const cmd = new GetCommentsForPullRequestCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function updateComment(\n commentId: string,\n content: string,\n): Promise<UpdateCommentOutput> {\n const input: UpdateCommentInput = {\n commentId,\n content,\n };\n const cmd = new UpdateCommentCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function createPrComment(\n pullRequestId: string,\n repositoryName: string | undefined,\n content: string,\n beforeCommitId: string,\n afterCommitId: string,\n): Promise<PostCommentForPullRequestOutput> {\n const input: PostCommentForPullRequestInput = {\n pullRequestId,\n repositoryName,\n content,\n afterCommitId,\n beforeCommitId,\n };\n const cmd = new PostCommentForPullRequestCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\n// export async function fastForwardMerge(\n// repositoryName: string,\n// sourceCommitSpecifier: string,\n// destinationReference: string\n// ): Promise<MergeBranchesByFastForwardOutput> {\n// const input: MergeBranchesByFastForwardInput = {\n// repositoryName,\n// sourceCommitSpecifier,\n// destinationCommitSpecifier: destinationReference,\n// targetBranch: destinationReference,\n// };\n// const cmd = new MergeBranchesByFastForwardCommand(input);\n// return await codeCommitClient.send(cmd);\n// }\n\n// export async function squashMerge(\n// repositoryName: string,\n// sourceCommitSpecifier: string,\n// destinationReference: string,\n// commitMessage: string | undefined\n// ): Promise<MergeBranchesBySquashOutput> {\n// const input: MergeBranchesBySquashInput = {\n// repositoryName,\n// sourceCommitSpecifier,\n// destinationCommitSpecifier: destinationReference,\n// targetBranch: destinationReference,\n// commitMessage,\n// };\n// const cmd = new MergeBranchesBySquashCommand(input);\n// return await codeCommitClient.send(cmd);\n// }\n\nexport async function updatePrStatus(\n pullRequestId: string,\n pullRequestStatus: PullRequestStatusEnum,\n): Promise<UpdatePullRequestStatusOutput> {\n const input: UpdatePullRequestStatusInput = {\n pullRequestId,\n pullRequestStatus,\n };\n const cmd = new UpdatePullRequestStatusCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function updatePrTitle(\n prNo: string,\n title: string,\n): Promise<UpdatePullRequestTitleOutput> {\n const input: UpdatePullRequestTitleInput = {\n pullRequestId: `${prNo}`,\n title,\n };\n const cmd = new UpdatePullRequestTitleCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function updatePrDescription(\n pullRequestId: string,\n description: string,\n): Promise<UpdatePullRequestDescriptionOutput> {\n const input: UpdatePullRequestDescriptionInput = {\n pullRequestId,\n description,\n };\n const cmd = new UpdatePullRequestDescriptionCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function createPr(\n title: string,\n description: string,\n sourceReference: string,\n destinationReference: string,\n repositoryName: string | undefined,\n): Promise<CreatePullRequestOutput> {\n const input: CreatePullRequestInput = {\n title,\n description,\n targets: [\n {\n sourceReference,\n destinationReference,\n repositoryName,\n },\n ],\n };\n const cmd = new CreatePullRequestCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getFile(\n repositoryName: string | undefined,\n filePath: string,\n commitSpecifier: string | undefined,\n): Promise<GetFileOutput> {\n const input: GetFileInput = {\n repositoryName,\n filePath,\n commitSpecifier,\n };\n const cmd: GetFileCommand = new GetFileCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function listPullRequests(\n repositoryName: string,\n): Promise<ListPullRequestsOutput> {\n const input: ListPullRequestsInput = {\n repositoryName,\n pullRequestStatus: PullRequestStatusEnum.OPEN,\n };\n\n const cmd = new ListPullRequestsCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getRepositoryInfo(\n repository: string,\n): Promise<GetRepositoryOutput> {\n const input: GetRepositoryInput = {\n repositoryName: `${repository}`,\n };\n const cmd = new GetRepositoryCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getPr(\n pullRequestId: string,\n): Promise<GetPullRequestOutput | undefined> {\n const input: GetPullRequestInput = {\n pullRequestId,\n };\n const cmd = new GetPullRequestCommand(input);\n let res;\n try {\n res = await codeCommitClient.send(cmd);\n } catch (err) {\n logger.debug({ err }, 'failed to get PR using prId');\n }\n return res;\n}\n\nexport async function listRepositories(): Promise<ListRepositoriesOutput> {\n const input: ListRepositoriesInput = {};\n const cmd = new ListRepositoriesCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function createPrApprovalRule(\n pullRequestId: string,\n approvalRuleContent: string,\n): Promise<CreatePullRequestApprovalRuleOutput> {\n const input: CreatePullRequestApprovalRuleInput = {\n approvalRuleContent,\n approvalRuleName: 'Reviewers By Renovate',\n pullRequestId,\n };\n const cmd = new CreatePullRequestApprovalRuleCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport function getCodeCommitUrl(\n repoMetadata: RepositoryMetadata,\n repoName: string,\n): string {\n logger.debug('get code commit url');\n const env = getEnv();\n if (!env.AWS_ACCESS_KEY_ID || !env.AWS_SECRET_ACCESS_KEY) {\n if (repoMetadata.cloneUrlHttp) {\n return repoMetadata.cloneUrlHttp;\n }\n // shouldn't reach here, but just in case\n return `https://git-codecommit.${\n env.AWS_REGION ?? 'us-east-1'\n }.amazonaws.com/v1/repos/${repoName}`;\n }\n\n const signer = new aws4.RequestSigner({\n service: 'codecommit',\n host: `git-codecommit.${env.AWS_REGION ?? 'us-east-1'}.amazonaws.com`,\n method: 'GIT',\n path: `v1/repos/${repoName}`,\n });\n const dateTime = signer.getDateTime();\n\n /* v8 ignore next -- defensive: the SigV4 signer always returns a datetime string */\n if (!isString(dateTime)) {\n throw new Error(REPOSITORY_UNINITIATED);\n }\n\n const token = `${dateTime}Z${signer.signature()}`;\n\n let username = `${env.AWS_ACCESS_KEY_ID}${\n env.AWS_SESSION_TOKEN ? `%${env.AWS_SESSION_TOKEN}` : ''\n }`;\n\n // massaging username with the session token,\n /* v8 ignore next -- only hit when an AWS session token contains '/', not present in spec env */\n if (username.includes('/')) {\n username = username.replace(/\\//g, '%2F');\n }\n return `https://${username}:${token}@git-codecommit.${\n env.AWS_REGION ?? 'us-east-1'\n }.amazonaws.com/v1/repos/${repoName}`;\n}\n"],"mappings":";;;;;;;AAuDA,IAAI;AAEJ,SAAgB,wBAA8B;CAC5C,IAAI,CAAC,kBACH,mBAAmB,IAAI,iBAAiB,CAAC,CAAC;;CAI5C,IAAI,CAAC,kBACH,MAAM,IAAI,MAAM,wCAAwC;AAE5D;AAEA,eAAsB,cACpB,WACqC;CAIrC,MAAM,MAAM,IAAI,4BAA4B,EAF1C,UAE8C,CAAC;CACjD,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,eAAsB,cACpB,eAC0C;CAI1C,MAAM,MAAM,IAAI,iCAAiC,EAF/C,cAEmD,CAAC;CACtD,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,eAAsB,cACp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S,GAAG,GACvB,WAAW,SAAS,QAAQ,OAAO,KAAK;CAE1C,OAAO,WAAW,SAAS,GAAG,MAAM,kBAClC,IAAI,cAAc,YACnB,0BAA0B;AAC7B"}
|
|
1
|
+
{"version":3,"file":"codecommit-client.js","names":[],"sources":["../../../../lib/modules/platform/codecommit/codecommit-client.ts"],"sourcesContent":["import type {\n CreatePullRequestApprovalRuleInput,\n CreatePullRequestApprovalRuleOutput,\n CreatePullRequestInput,\n CreatePullRequestOutput,\n DeleteCommentContentInput,\n DeleteCommentContentOutput,\n GetCommentsForPullRequestInput,\n GetCommentsForPullRequestOutput,\n GetFileInput,\n GetFileOutput,\n GetPullRequestInput,\n GetPullRequestOutput,\n GetRepositoryInput,\n GetRepositoryOutput,\n ListPullRequestsInput,\n ListPullRequestsOutput,\n ListRepositoriesInput,\n ListRepositoriesOutput,\n PostCommentForPullRequestInput,\n PostCommentForPullRequestOutput,\n RepositoryMetadata,\n UpdateCommentInput,\n UpdateCommentOutput,\n UpdatePullRequestDescriptionInput,\n UpdatePullRequestDescriptionOutput,\n UpdatePullRequestStatusInput,\n UpdatePullRequestStatusOutput,\n UpdatePullRequestTitleInput,\n UpdatePullRequestTitleOutput,\n} from '@aws-sdk/client-codecommit';\nimport {\n CodeCommitClient,\n CreatePullRequestApprovalRuleCommand,\n CreatePullRequestCommand,\n DeleteCommentContentCommand,\n GetCommentsForPullRequestCommand,\n GetFileCommand,\n GetPullRequestCommand,\n GetRepositoryCommand,\n ListPullRequestsCommand,\n ListRepositoriesCommand,\n PostCommentForPullRequestCommand,\n PullRequestStatusEnum,\n UpdateCommentCommand,\n UpdatePullRequestDescriptionCommand,\n UpdatePullRequestStatusCommand,\n UpdatePullRequestTitleCommand,\n} from '@aws-sdk/client-codecommit';\nimport { isString } from '@sindresorhus/is';\nimport * as aws4 from 'aws4';\nimport { REPOSITORY_UNINITIATED } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport { getEnv } from '../../../util/env.ts';\nimport { regEx } from '../../../util/regex.ts';\n\nlet codeCommitClient: CodeCommitClient;\n\nexport function buildCodeCommitClient(): void {\n if (!codeCommitClient) {\n codeCommitClient = new CodeCommitClient({});\n }\n\n /* v8 ignore next -- unreachable: the client was just constructed above */\n if (!codeCommitClient) {\n throw new Error('Failed to initialize codecommit client');\n }\n}\n\nexport async function deleteComment(\n commentId: string,\n): Promise<DeleteCommentContentOutput> {\n const input: DeleteCommentContentInput = {\n commentId,\n };\n const cmd = new DeleteCommentContentCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getPrComments(\n pullRequestId: string,\n): Promise<GetCommentsForPullRequestOutput> {\n const input: GetCommentsForPullRequestInput = {\n pullRequestId,\n };\n const cmd = new GetCommentsForPullRequestCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function updateComment(\n commentId: string,\n content: string,\n): Promise<UpdateCommentOutput> {\n const input: UpdateCommentInput = {\n commentId,\n content,\n };\n const cmd = new UpdateCommentCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function createPrComment(\n pullRequestId: string,\n repositoryName: string | undefined,\n content: string,\n beforeCommitId: string,\n afterCommitId: string,\n): Promise<PostCommentForPullRequestOutput> {\n const input: PostCommentForPullRequestInput = {\n pullRequestId,\n repositoryName,\n content,\n afterCommitId,\n beforeCommitId,\n };\n const cmd = new PostCommentForPullRequestCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\n// export async function fastForwardMerge(\n// repositoryName: string,\n// sourceCommitSpecifier: string,\n// destinationReference: string\n// ): Promise<MergeBranchesByFastForwardOutput> {\n// const input: MergeBranchesByFastForwardInput = {\n// repositoryName,\n// sourceCommitSpecifier,\n// destinationCommitSpecifier: destinationReference,\n// targetBranch: destinationReference,\n// };\n// const cmd = new MergeBranchesByFastForwardCommand(input);\n// return await codeCommitClient.send(cmd);\n// }\n\n// export async function squashMerge(\n// repositoryName: string,\n// sourceCommitSpecifier: string,\n// destinationReference: string,\n// commitMessage: string | undefined\n// ): Promise<MergeBranchesBySquashOutput> {\n// const input: MergeBranchesBySquashInput = {\n// repositoryName,\n// sourceCommitSpecifier,\n// destinationCommitSpecifier: destinationReference,\n// targetBranch: destinationReference,\n// commitMessage,\n// };\n// const cmd = new MergeBranchesBySquashCommand(input);\n// return await codeCommitClient.send(cmd);\n// }\n\nexport async function updatePrStatus(\n pullRequestId: string,\n pullRequestStatus: PullRequestStatusEnum,\n): Promise<UpdatePullRequestStatusOutput> {\n const input: UpdatePullRequestStatusInput = {\n pullRequestId,\n pullRequestStatus,\n };\n const cmd = new UpdatePullRequestStatusCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function updatePrTitle(\n prNo: string,\n title: string,\n): Promise<UpdatePullRequestTitleOutput> {\n const input: UpdatePullRequestTitleInput = {\n pullRequestId: `${prNo}`,\n title,\n };\n const cmd = new UpdatePullRequestTitleCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function updatePrDescription(\n pullRequestId: string,\n description: string,\n): Promise<UpdatePullRequestDescriptionOutput> {\n const input: UpdatePullRequestDescriptionInput = {\n pullRequestId,\n description,\n };\n const cmd = new UpdatePullRequestDescriptionCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function createPr(\n title: string,\n description: string,\n sourceReference: string,\n destinationReference: string,\n repositoryName: string | undefined,\n): Promise<CreatePullRequestOutput> {\n const input: CreatePullRequestInput = {\n title,\n description,\n targets: [\n {\n sourceReference,\n destinationReference,\n repositoryName,\n },\n ],\n };\n const cmd = new CreatePullRequestCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getFile(\n repositoryName: string | undefined,\n filePath: string,\n commitSpecifier: string | undefined,\n): Promise<GetFileOutput> {\n const input: GetFileInput = {\n repositoryName,\n filePath,\n commitSpecifier,\n };\n const cmd: GetFileCommand = new GetFileCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function listPullRequests(\n repositoryName: string,\n): Promise<ListPullRequestsOutput> {\n const input: ListPullRequestsInput = {\n repositoryName,\n pullRequestStatus: PullRequestStatusEnum.OPEN,\n };\n\n const cmd = new ListPullRequestsCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getRepositoryInfo(\n repository: string,\n): Promise<GetRepositoryOutput> {\n const input: GetRepositoryInput = {\n repositoryName: `${repository}`,\n };\n const cmd = new GetRepositoryCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function getPr(\n pullRequestId: string,\n): Promise<GetPullRequestOutput | undefined> {\n const input: GetPullRequestInput = {\n pullRequestId,\n };\n const cmd = new GetPullRequestCommand(input);\n let res;\n try {\n res = await codeCommitClient.send(cmd);\n } catch (err) {\n logger.debug({ err }, 'failed to get PR using prId');\n }\n return res;\n}\n\nexport async function listRepositories(): Promise<ListRepositoriesOutput> {\n const input: ListRepositoriesInput = {};\n const cmd = new ListRepositoriesCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport async function createPrApprovalRule(\n pullRequestId: string,\n approvalRuleContent: string,\n): Promise<CreatePullRequestApprovalRuleOutput> {\n const input: CreatePullRequestApprovalRuleInput = {\n approvalRuleContent,\n approvalRuleName: 'Reviewers By Renovate',\n pullRequestId,\n };\n const cmd = new CreatePullRequestApprovalRuleCommand(input);\n return await codeCommitClient.send(cmd);\n}\n\nexport function getCodeCommitUrl(\n repoMetadata: RepositoryMetadata,\n repoName: string,\n): string {\n logger.debug('get code commit url');\n const env = getEnv();\n if (!env.AWS_ACCESS_KEY_ID || !env.AWS_SECRET_ACCESS_KEY) {\n if (repoMetadata.cloneUrlHttp) {\n return repoMetadata.cloneUrlHttp;\n }\n // shouldn't reach here, but just in case\n return `https://git-codecommit.${\n env.AWS_REGION ?? 'us-east-1'\n }.amazonaws.com/v1/repos/${repoName}`;\n }\n\n const signer = new aws4.RequestSigner({\n service: 'codecommit',\n host: `git-codecommit.${env.AWS_REGION ?? 'us-east-1'}.amazonaws.com`,\n method: 'GIT',\n path: `v1/repos/${repoName}`,\n });\n const dateTime = signer.getDateTime();\n\n /* v8 ignore next -- defensive: the SigV4 signer always returns a datetime string */\n if (!isString(dateTime)) {\n throw new Error(REPOSITORY_UNINITIATED);\n }\n\n const token = `${dateTime}Z${signer.signature()}`;\n\n let username = `${env.AWS_ACCESS_KEY_ID}${\n env.AWS_SESSION_TOKEN ? `%${env.AWS_SESSION_TOKEN}` : ''\n }`;\n\n // massaging username with the session token,\n /* v8 ignore next -- only hit when an AWS session token contains '/', not present in spec env */\n if (username.includes('/')) {\n username = username.replace(regEx(/\\//g), '%2F');\n }\n return `https://${username}:${token}@git-codecommit.${\n env.AWS_REGION ?? 'us-east-1'\n }.amazonaws.com/v1/repos/${repoName}`;\n}\n"],"mappings":";;;;;;;;AAwDA,IAAI;AAEJ,SAAgB,wBAA8B;CAC5C,IAAI,CAAC,kBACH,mBAAmB,IAAI,iBAAiB,CAAC,CAAC;;CAI5C,IAAI,CAAC,kBACH,MAAM,IAAI,MAAM,wCAAwC;AAE5D;AAEA,eAAsB,cACpB,WACqC;CAIrC,MAAM,MAAM,IAAI,4BAA4B,EAF1C,UAE8C,CAAC;CACjD,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,eAAsB,cACpB,eAC0C;CAI1C,MAAM,MAAM,IAAI,iCAAiC,EAF/C,cAEmD,CAAC;CACtD,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,eAAsB,cACpB,WACA,SAC8B;CAK9B,MAAM,MAAM,IAAI,qBAAqB;EAHnC;EACA;CAEuC,CAAC;CAC1C,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,eAAsB,gBACpB,eACA,gBACA,SACA,gBACA,eAC0C;CAQ1C,MAAM,MAAM,IAAI,iCAAiC;EAN/C;EACA;EACA;EACA;EACA;CAEmD,CAAC;CACtD,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAkCA,eAAsB,eACpB,eACA,mBACwC;CAKxC,MAAM,MAAM,IAAI,+BAA+B;EAH7C;EACA;CAEiD,CAA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AAEA,eAAsB,mBAAoD;CAExE,MAAM,MAAM,IAAI,wBAAwB,CAAI,CAAC;CAC7C,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,eAAsB,qBACpB,eACA,qBAC8C;CAM9C,MAAM,MAAM,IAAI,qCAAqC;EAJnD;EACA,kBAAkB;EAClB;CAEuD,CAAC;CAC1D,OAAO,MAAM,iBAAiB,KAAK,GAAG;AACxC;AAEA,SAAgB,iBACd,cACA,UACQ;CACR,OAAO,MAAM,qBAAqB;CAClC,MAAM,MAAM,OAAO;CACnB,IAAI,CAAC,IAAI,qBAAqB,CAAC,IAAI,uBAAuB;EACxD,IAAI,aAAa,cACf,OAAO,aAAa;EAGtB,OAAO,0BACL,IAAI,cAAc,YACnB,0BAA0B;CAC7B;CAEA,MAAM,SAAS,IAAI,KAAK,cAAc;EACpC,SAAS;EACT,MAAM,kBAAkB,IAAI,cAAc,YAAY;EACtD,QAAQ;EACR,MAAM,YAAY;CACpB,CAAC;CACD,MAAM,WAAW,OAAO,YAAY;;CAGpC,IAAI,CAAC,SAAS,QAAQ,GACpB,MAAM,IAAI,MAAM,sBAAsB;CAGxC,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,UAAU;CAE9C,IAAI,WAAW,GAAG,IAAI,oBACpB,IAAI,oBAAoB,IAAI,IAAI,sBAAsB;;CAKxD,IAAI,SAAS,SAAS,GAAG,GACvB,WAAW,SAAS,QAAQ,MAAM,KAAK,GAAG,KAAK;CAEjD,OAAO,WAAW,SAAS,GAAG,MAAM,kBAClC,IAAI,cAAc,YACnB,0BAA0B;AAC7B"}
|
|
@@ -86,7 +86,7 @@ function extractSourceBranch(change) {
|
|
|
86
86
|
}
|
|
87
87
|
function findPullRequestBody(change) {
|
|
88
88
|
const msg = Array.from(change.messages ?? []).reverse().find((msg) => msg.tag === TAG_PULL_REQUEST_BODY);
|
|
89
|
-
if (msg) return msg.message.replace(/^Patch Set \d+:\n\n
|
|
89
|
+
if (msg) return msg.message.replace(regEx(/^Patch Set \d+:\n\n/), "");
|
|
90
90
|
}
|
|
91
91
|
function mapBranchStatusToLabel(state, label) {
|
|
92
92
|
const numbers = Object.keys(label.values).map((x) => parseInt(x, 10));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["hostRules.find"],"sources":["../../../../lib/modules/platform/gerrit/utils.ts"],"sourcesContent":["import { CONFIG_GIT_URL_UNAVAILABLE } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { BranchStatus, PrState } from '../../../types/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { toLongCommitSha } from '../../../util/schema-utils/git.ts';\nimport { joinUrlParts, parseUrl } from '../../../util/url.ts';\nimport { hashBody } from '../pr-body.ts';\nimport type { GitUrlOption, Pr } from '../types.ts';\nimport type { GerritChange, GerritLabelTypeInfo } from './schema.ts';\nimport type { GerritChangeStatus, GerritRequestDetail } from './types.ts';\n\nexport const MIN_GERRIT_VERSION = '3.0.0';\n\nexport const TAG_PULL_REQUEST_BODY = 'pull-request';\n\nconst DEFAULT_SSH_PORT = `29418`;\n\n/**\n * Max comment size in Gerrit (16kiB by default)\n * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#change:~:text=change.commentSizeLimit\n */\nexport const MAX_GERRIT_COMMENT_SIZE = 16 * 1024;\n\nexport const REQUEST_DETAILS_FOR_PRS: GerritRequestDetail[] = [\n 'MESSAGES', // to get the pr body\n 'LABELS', // to get the reviewers\n 'DETAILED_ACCOUNTS', // to get the reviewers usernames\n 'CURRENT_REVISION', // to get the commit message\n 'COMMIT_FOOTERS', // to get the commit message\n] as const;\n\nexport function getGerritRepoUrl(\n repository: string,\n endpoint: string,\n gitUrl: GitUrlOption | undefined,\n username: string,\n): string {\n const endpointUrl = parseUrl(endpoint);\n if (!endpointUrl) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n\n const url =\n gitUrl === 'ssh'\n ? createSshUrl(endpointUrl, repository, username)\n : createHttpUrl(endpointUrl, endpoint, repository);\n logger.trace({ url }, 'using URL based on configured endpoint');\n\n return url;\n}\n\nfunction createSshUrl(url: URL, repository: string, username: string): string {\n return `ssh://${username}@${url.hostname}:${DEFAULT_SSH_PORT}/${repository}`;\n}\n\nfunction createHttpUrl(url: URL, endpoint: string, repository: string): string {\n // Find options for current host and determine Git endpoint\n const opts = hostRules.find({\n hostType: 'gerrit',\n url: endpoint,\n });\n\n if (!(opts.username && opts.password)) {\n throw new Error(\n 'Init: You must configure a Gerrit Server username/password',\n );\n }\n\n url.username = opts.username;\n url.password = opts.password;\n url.pathname = joinUrlParts(\n url.pathname,\n 'a',\n encodeURIComponent(repository),\n );\n return url.toString();\n}\n\nexport function mapPrStateToGerritFilter(state?: PrState): string | null {\n switch (state) {\n case 'merged':\n return 'status:merged';\n case 'open':\n return 'status:open';\n case 'closed':\n return 'status:abandoned';\n case '!open':\n return '-status:open';\n case 'all':\n default:\n return null;\n }\n}\n\nexport function mapGerritChangeToPr(\n change: GerritChange,\n knownProperties?: {\n sourceBranch?: string;\n prBody?: string;\n },\n): Pr | null {\n const sourceBranch =\n knownProperties?.sourceBranch ?? extractSourceBranch(change);\n if (!sourceBranch) {\n return null;\n }\n return {\n number: change._number,\n state: mapGerritChangeStateToPrState(change.status),\n sourceBranch,\n targetBranch: change.branch,\n title: change.subject,\n createdAt: convertGerritDateToISO(change.created),\n labels: change.hashtags,\n reviewers:\n change.reviewers?.REVIEWER?.map((reviewer) => reviewer.username!) ?? [],\n bodyStruct: {\n hash: hashBody(knownProperties?.prBody ?? findPullRequestBody(change)),\n },\n sha: toLongCommitSha(change.current_revision),\n };\n}\n\nexport function mapGerritChangeStateToPrState(\n state: GerritChangeStatus,\n): 'merged' | 'open' | 'closed' {\n switch (state) {\n case 'NEW':\n return 'open';\n case 'MERGED':\n return 'merged';\n case 'ABANDONED':\n return 'closed';\n }\n}\n\nexport function extractSourceBranch(change: GerritChange): string | undefined {\n let sourceBranch: string | undefined = undefined;\n\n if (change.current_revision) {\n const re = regEx(/^Renovate-Branch: (.+)$/m);\n const currentRevision = change.revisions![change.current_revision];\n const message = currentRevision.commit_with_footers;\n // v8 ignore else -- TODO: add test #40625\n if (message) {\n sourceBranch = re.exec(message)?.[1];\n }\n }\n\n return sourceBranch ?? undefined;\n}\n\nexport function findPullRequestBody(change: GerritChange): string | undefined {\n const msg = Array.from(change.messages ?? [])\n .reverse()\n .find((msg) => msg.tag === TAG_PULL_REQUEST_BODY);\n if (msg) {\n // Gerrit adds a \"Patch Set X:\" prefix to comments\n return msg.message.replace(/^Patch Set \\d+:\\n\\n
|
|
1
|
+
{"version":3,"file":"utils.js","names":["hostRules.find"],"sources":["../../../../lib/modules/platform/gerrit/utils.ts"],"sourcesContent":["import { CONFIG_GIT_URL_UNAVAILABLE } from '../../../constants/error-messages.ts';\nimport { logger } from '../../../logger/index.ts';\nimport type { BranchStatus, PrState } from '../../../types/index.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { toLongCommitSha } from '../../../util/schema-utils/git.ts';\nimport { joinUrlParts, parseUrl } from '../../../util/url.ts';\nimport { hashBody } from '../pr-body.ts';\nimport type { GitUrlOption, Pr } from '../types.ts';\nimport type { GerritChange, GerritLabelTypeInfo } from './schema.ts';\nimport type { GerritChangeStatus, GerritRequestDetail } from './types.ts';\n\nexport const MIN_GERRIT_VERSION = '3.0.0';\n\nexport const TAG_PULL_REQUEST_BODY = 'pull-request';\n\nconst DEFAULT_SSH_PORT = `29418`;\n\n/**\n * Max comment size in Gerrit (16kiB by default)\n * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#change:~:text=change.commentSizeLimit\n */\nexport const MAX_GERRIT_COMMENT_SIZE = 16 * 1024;\n\nexport const REQUEST_DETAILS_FOR_PRS: GerritRequestDetail[] = [\n 'MESSAGES', // to get the pr body\n 'LABELS', // to get the reviewers\n 'DETAILED_ACCOUNTS', // to get the reviewers usernames\n 'CURRENT_REVISION', // to get the commit message\n 'COMMIT_FOOTERS', // to get the commit message\n] as const;\n\nexport function getGerritRepoUrl(\n repository: string,\n endpoint: string,\n gitUrl: GitUrlOption | undefined,\n username: string,\n): string {\n const endpointUrl = parseUrl(endpoint);\n if (!endpointUrl) {\n throw new Error(CONFIG_GIT_URL_UNAVAILABLE);\n }\n\n const url =\n gitUrl === 'ssh'\n ? createSshUrl(endpointUrl, repository, username)\n : createHttpUrl(endpointUrl, endpoint, repository);\n logger.trace({ url }, 'using URL based on configured endpoint');\n\n return url;\n}\n\nfunction createSshUrl(url: URL, repository: string, username: string): string {\n return `ssh://${username}@${url.hostname}:${DEFAULT_SSH_PORT}/${repository}`;\n}\n\nfunction createHttpUrl(url: URL, endpoint: string, repository: string): string {\n // Find options for current host and determine Git endpoint\n const opts = hostRules.find({\n hostType: 'gerrit',\n url: endpoint,\n });\n\n if (!(opts.username && opts.password)) {\n throw new Error(\n 'Init: You must configure a Gerrit Server username/password',\n );\n }\n\n url.username = opts.username;\n url.password = opts.password;\n url.pathname = joinUrlParts(\n url.pathname,\n 'a',\n encodeURIComponent(repository),\n );\n return url.toString();\n}\n\nexport function mapPrStateToGerritFilter(state?: PrState): string | null {\n switch (state) {\n case 'merged':\n return 'status:merged';\n case 'open':\n return 'status:open';\n case 'closed':\n return 'status:abandoned';\n case '!open':\n return '-status:open';\n case 'all':\n default:\n return null;\n }\n}\n\nexport function mapGerritChangeToPr(\n change: GerritChange,\n knownProperties?: {\n sourceBranch?: string;\n prBody?: string;\n },\n): Pr | null {\n const sourceBranch =\n knownProperties?.sourceBranch ?? extractSourceBranch(change);\n if (!sourceBranch) {\n return null;\n }\n return {\n number: change._number,\n state: mapGerritChangeStateToPrState(change.status),\n sourceBranch,\n targetBranch: change.branch,\n title: change.subject,\n createdAt: convertGerritDateToISO(change.created),\n labels: change.hashtags,\n reviewers:\n change.reviewers?.REVIEWER?.map((reviewer) => reviewer.username!) ?? [],\n bodyStruct: {\n hash: hashBody(knownProperties?.prBody ?? findPullRequestBody(change)),\n },\n sha: toLongCommitSha(change.current_revision),\n };\n}\n\nexport function mapGerritChangeStateToPrState(\n state: GerritChangeStatus,\n): 'merged' | 'open' | 'closed' {\n switch (state) {\n case 'NEW':\n return 'open';\n case 'MERGED':\n return 'merged';\n case 'ABANDONED':\n return 'closed';\n }\n}\n\nexport function extractSourceBranch(change: GerritChange): string | undefined {\n let sourceBranch: string | undefined = undefined;\n\n if (change.current_revision) {\n const re = regEx(/^Renovate-Branch: (.+)$/m);\n const currentRevision = change.revisions![change.current_revision];\n const message = currentRevision.commit_with_footers;\n // v8 ignore else -- TODO: add test #40625\n if (message) {\n sourceBranch = re.exec(message)?.[1];\n }\n }\n\n return sourceBranch ?? undefined;\n}\n\nexport function findPullRequestBody(change: GerritChange): string | undefined {\n const msg = Array.from(change.messages ?? [])\n .reverse()\n .find((msg) => msg.tag === TAG_PULL_REQUEST_BODY);\n if (msg) {\n // Gerrit adds a \"Patch Set X:\" prefix to comments\n return msg.message.replace(regEx(/^Patch Set \\d+:\\n\\n/), '');\n }\n return undefined;\n}\n\nexport function mapBranchStatusToLabel(\n state: BranchStatus | 'UNKNOWN', // suppress default path code removal\n label: GerritLabelTypeInfo,\n): number {\n const numbers = Object.keys(label.values).map((x) => parseInt(x, 10));\n switch (state) {\n case 'green':\n return Math.max(...numbers);\n case 'yellow':\n case 'red':\n return Math.min(...numbers);\n }\n /* v8 ignore next -- only reachable for the artificial 'UNKNOWN' state, which callers never pass */\n return label.default_value;\n}\n\n// Convert Gerrit date format to ISO format\nexport function convertGerritDateToISO(date: string): string {\n return date.replace(' ', 'T');\n}\n"],"mappings":";;;;;;;;AAYA,MAAa,qBAAqB;AAElC,MAAa,wBAAwB;AAErC,MAAM,mBAAmB;;;;;AAMzB,MAAa,0BAA0B;AAEvC,MAAa,0BAAiD;CAC5D;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,iBACd,YACA,UACA,QACA,UACQ;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9C;AACF;AAEA,SAAgB,8BACd,OAC8B;CAC9B,QAAQ,OAAR;EACE,KAAK,OACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,aACH,OAAO;CACX;AACF;AAEA,SAAgB,oBAAoB,QAA0C;CAC5E,IAAI,eAAmC,KAAA;CAEvC,IAAI,OAAO,kBAAkB;EAC3B,MAAM,KAAK,MAAM,0BAA0B;EAE3C,MAAM,UADkB,OAAO,UAAW,OAAO,iBAClB,CAAC;;EAEhC,IAAI,SACF,eAAe,GAAG,KAAK,OAAO,CAAC,GAAG;CAEtC;CAEA,OAAO,gBAAgB,KAAA;AACzB;AAEA,SAAgB,oBAAoB,QAA0C;CAC5E,MAAM,MAAM,MAAM,KAAK,OAAO,YAAY,CAAC,CAAC,CAAC,CAC1C,QAAQ,CAAC,CACT,MAAM,QAAQ,IAAI,QAAQ,qBAAqB;CAClD,IAAI,KAEF,OAAO,IAAI,QAAQ,QAAQ,MAAM,qBAAqB,GAAG,EAAE;AAG/D;AAEA,SAAgB,uBACd,OACA,OACQ;CACR,MAAM,UAAU,OAAO,KAAK,MAAM,MAAM,CAAC,CAAC,KAAK,MAAM,SAAS,GAAG,EAAE,CAAC;CACpE,QAAQ,OAAR;EACE,KAAK,SACH,OAAO,KAAK,IAAI,GAAG,OAAO;EAC5B,KAAK;EACL,KAAK,OACH,OAAO,KAAK,IAAI,GAAG,OAAO;CAC9B;;CAEA,OAAO,MAAM;AACf;AAGA,SAAgB,uBAAuB,MAAsB;CAC3D,OAAO,KAAK,QAAQ,KAAK,GAAG;AAC9B"}
|
|
@@ -117,7 +117,7 @@ async function detectGhe(token) {
|
|
|
117
117
|
async function initPlatform({ endpoint, token: originalToken, username, gitAuthor }) {
|
|
118
118
|
let token = originalToken;
|
|
119
119
|
if (!token) throw new Error("Init: You must configure a GitHub token");
|
|
120
|
-
token = token.replace(/^ghs_
|
|
120
|
+
token = token.replace(regEx(/^ghs_/), "x-access-token:ghs_");
|
|
121
121
|
platformConfig.isGHApp = token.startsWith("x-access-token:");
|
|
122
122
|
if (endpoint) {
|
|
123
123
|
if (!isHttpUrl(endpoint)) throw new Error(`Init: Invalid GitHub endpoint URL: ${endpoint}`);
|
|
@@ -172,13 +172,13 @@ async function initPlatform({ endpoint, token: originalToken, username, gitAutho
|
|
|
172
172
|
matchHost: "ghcr.io",
|
|
173
173
|
hostType: "docker",
|
|
174
174
|
username: "USERNAME",
|
|
175
|
-
password: token.replace(/^x-access-token
|
|
175
|
+
password: token.replace(regEx(/^x-access-token:/), "")
|
|
176
176
|
}];
|
|
177
177
|
logger.debug("Adding GitHub token as npm.pkg.github.com Basic token");
|
|
178
178
|
platformResult.hostRules.push({
|
|
179
179
|
matchHost: "npm.pkg.github.com",
|
|
180
180
|
hostType: "npm",
|
|
181
|
-
token: token.replace(/^x-access-token
|
|
181
|
+
token: token.replace(regEx(/^x-access-token:/), "")
|
|
182
182
|
});
|
|
183
183
|
for (const hostType of [
|
|
184
184
|
"rubygems",
|
|
@@ -190,7 +190,7 @@ async function initPlatform({ endpoint, token: originalToken, username, gitAutho
|
|
|
190
190
|
hostType,
|
|
191
191
|
matchHost: `${hostType}.pkg.github.com`,
|
|
192
192
|
username: renovateUsername,
|
|
193
|
-
password: token.replace(/^x-access-token
|
|
193
|
+
password: token.replace(regEx(/^x-access-token:/), "")
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -332,11 +332,11 @@ async function initRepo({ repository, forkCreation, forkOrg, forkToken, gitUrl,
|
|
|
332
332
|
try {
|
|
333
333
|
let infoQuery = repoInfoQuery;
|
|
334
334
|
if (platformConfig.isGhe && semver.satisfies(platformConfig.gheVersion, "<3.3.0")) {
|
|
335
|
-
infoQuery = infoQuery.replace(/\n\s*autoMergeAllowed\s*\n
|
|
336
|
-
infoQuery = infoQuery.replace(/\n\s*hasIssuesEnabled\s*\n
|
|
335
|
+
infoQuery = infoQuery.replace(regEx(/\n\s*autoMergeAllowed\s*\n/), "\n");
|
|
336
|
+
infoQuery = infoQuery.replace(regEx(/\n\s*hasIssuesEnabled\s*\n/), "\n");
|
|
337
337
|
}
|
|
338
|
-
if (platformConfig.isGhe && semver.satisfies(platformConfig.gheVersion, "<3.9.0")) infoQuery = infoQuery.replace(/\n\s*hasVulnerabilityAlertsEnabled\s*\n
|
|
339
|
-
if (platformConfig.isGhe && semver.satisfies(platformConfig.gheVersion, "<3.12.0")) infoQuery = infoQuery.replace(/\n\s*mergeQueue\s*\{\s*id\s*\}\s*\n
|
|
338
|
+
if (platformConfig.isGhe && semver.satisfies(platformConfig.gheVersion, "<3.9.0")) infoQuery = infoQuery.replace(regEx(/\n\s*hasVulnerabilityAlertsEnabled\s*\n/), "\n");
|
|
339
|
+
if (platformConfig.isGhe && semver.satisfies(platformConfig.gheVersion, "<3.12.0")) infoQuery = infoQuery.replace(regEx(/\n\s*mergeQueue\s*\{\s*id\s*\}\s*\n/), "\n");
|
|
340
340
|
const res = await githubApi.requestGraphql(infoQuery, {
|
|
341
341
|
variables: {
|
|
342
342
|
owner: config.repositoryOwner,
|