From 1c48cfea6a58ac88d01d2b1fe8293b74187e02d6 Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 7 Nov 2021 12:33:05 +0330 Subject: [PATCH 01/11] feat: add GITLAB_TOKEN_TYPE config fix: add missing dependencies to package.json --- .changeset/flat-chicken-repeat.md | 7 +++++++ .gitignore | 1 + README.md | 3 ++- package.json | 3 +++ src/index.ts | 24 +++++++++++++++++++++--- yarn.lock | 22 +++++++++++----------- 6 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 .changeset/flat-chicken-repeat.md diff --git a/.changeset/flat-chicken-repeat.md b/.changeset/flat-chicken-repeat.md new file mode 100644 index 00000000..f9e9fc4d --- /dev/null +++ b/.changeset/flat-chicken-repeat.md @@ -0,0 +1,7 @@ +--- +'changesets-gitlab': minor +--- + +Add missing dependencies to the package.json +Add support for job tokens and oauth tokens (via GITLAB_TOKEN_TYPE config) +Add eslintcache to gitignore diff --git a/.gitignore b/.gitignore index ed66ec70..ed1a3e3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ lib node_modules +.eslintcache .env .type-coverage *.log diff --git a/README.md b/README.md index fd9dfe65..f8062e2c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ GLOBAL_AGENT_NO_PROXY # Like above but for no proxied requests GITLAB_HOST # optional, if you're using custom GitLab host GITLAB_TOKEN # required, token with accessibility to push -GITLAB_CI_USER_NAME # required, username with accessibility to push, used in pairs of the above token +GITLAB_TOKEN_TYPE # optional, type of the provided token in GITLAB_TOKEN. defaults to personal access token. can be `job` if you provide the Gitlab CI_JOB_TOKEN or `oauth` if you use Gitlab Oauth token +GITLAB_CI_USER_NAME # required, username with accessibility to push, used in pairs of the above token (if it was personal access token) GITLAB_CI_USER_EMAIL # optional, default `gitlab[bot]@users.noreply.gitlab.com` ``` diff --git a/package.json b/package.json index 21614881..4b80725a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,10 @@ "@actions/exec": "^1.1.0", "@changesets/assemble-release-plan": "^5.0.2", "@changesets/config": "^1.6.2", + "@changesets/errors": "^0.1.4", "@changesets/parse": "^0.3.9", + "@changesets/pre": "^1.0.7", + "@changesets/read": "^0.5.0", "@changesets/types": "^4.0.0", "@gitbeaker/node": "^34.6.0", "@manypkg/get-packages": "^1.1.3", diff --git a/src/index.ts b/src/index.ts index ebcabba2..7190fab1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,9 @@ declare global { } } +type ConstructorArgs = T extends new (...args: infer U) => any ? U : never +type GitlabConfig = ConstructorArgs[0] + export const createApi = (gitlabToken?: string) => { bootstrap() @@ -22,8 +25,23 @@ export const createApi = (gitlabToken?: string) => { } } - return new Gitlab({ + const config: GitlabConfig = { host: process.env.GITLAB_HOST, - token: gitlabToken || process.env.GITLAB_TOKEN, - }) + } + + const token = gitlabToken || process.env.GITLAB_TOKEN + + switch (process.env.GITLAB_TOKEN_TYPE) { + case 'job': + config.jobToken = token + break + case 'oauth': + config.oauthToken = token + break + default: + config.token = token + break + } + + return new Gitlab(config) } diff --git a/yarn.lock b/yarn.lock index 98384c0c..364e6edf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -402,7 +402,7 @@ dependencies: "@babel/types" "^7.16.0" -"@babel/helper-hoist-variables@^7.16.0": +"@babel/helper-hoist-variables@^7.14.5", "@babel/helper-hoist-variables@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz#4c9023c2f1def7e28ff46fc1dbcd36a39beaa81a" integrity sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg== @@ -554,13 +554,13 @@ "@babel/plugin-proposal-optional-chaining" "^7.16.0" "@babel/plugin-proposal-async-do-expressions@^7.14.0": - version "7.16.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-do-expressions/-/plugin-proposal-async-do-expressions-7.16.0.tgz#c747dc2696cf4018578ee441e2cd60d6585d4e33" - integrity sha512-nrAVI0MW6N+voMBE0MbfscU/vnIGxdhaLU0KgkuGA26hLi+rmrEAdJ/HAXVCx0WOmBXTfhbSP1FlL6lZSIWrTg== + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-do-expressions/-/plugin-proposal-async-do-expressions-7.14.5.tgz#0aadb8806809246d64682be1b82a6956015e2077" + integrity sha512-AP38yW7vyOzBY/SS0477k/ddmwpLO3x5rYu5bc+wLpLhfjr+lISt0woizugqQvHdzY4K50rBE+h6JXFQh41TGw== dependencies: - "@babel/helper-hoist-variables" "^7.16.0" + "@babel/helper-hoist-variables" "^7.14.5" "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-async-do-expressions" "^7.16.0" + "@babel/plugin-syntax-async-do-expressions" "^7.14.5" "@babel/plugin-proposal-async-generator-functions@^7.16.4": version "7.16.4" @@ -767,7 +767,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.16.0" "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-async-do-expressions@^7.16.0": +"@babel/plugin-syntax-async-do-expressions@^7.14.5": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-do-expressions/-/plugin-syntax-async-do-expressions-7.16.0.tgz#5fc7e4bca519979a92fd9596d07baee681e37a01" integrity sha512-3p9KuwOHUXSx/a52S349DKjnfYWtyims8d8kT7MsTI59HmnTaO4MWT159Nc0e1m8773h/8cG44nVtH2V8dDtJg== @@ -1593,7 +1593,7 @@ "@manypkg/get-packages" "^1.0.1" fs-extra "^7.0.1" -"@changesets/read@^0.5.1": +"@changesets/read@^0.5.0", "@changesets/read@^0.5.1": version "0.5.1" resolved "https://registry.yarnpkg.com/@changesets/read/-/read-0.5.1.tgz#89635bf2b84e5fd5d49e1d685adb9c47b5e679a1" integrity sha512-QJ3rVS+L0Y3yLk3cAOglNh4tuMUfQl8cJjyAnNnJHS9nCXZUiZjYiJc+34XpZT5vUb+4+0FY1wWtzlkAKuLR2g== @@ -3057,9 +3057,9 @@ acorn@^7.1.1, acorn@^7.4.0: integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== acorn@^8.2.4, acorn@^8.4.1: - version "8.6.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.6.0.tgz#e3692ba0eb1a0c83eaa4f37f5fa7368dd7142895" - integrity sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw== + version "8.5.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" + integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== agent-base@6: version "6.0.2" From 2f0d5f651a61c4f8682a3880587e91fc9c3c4080 Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 7 Nov 2021 12:55:05 +0330 Subject: [PATCH 02/11] feat: add prepack script --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 4b80725a..0cc202c6 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "lint": "run-p lint:*", "lint:es": "eslint . --cache -f friendly", "lint:tsc": "tsc --noEmit", + "prepack": "yarn build:ts", "prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0", "prerelease": "yarn build", "release": "changeset publish", From c56ffd3609a629036ddadeb8518f2e138652bebd Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sat, 20 Nov 2021 23:27:20 +0330 Subject: [PATCH 03/11] fix: comment bug --- src/comment.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/comment.ts b/src/comment.ts index 81d1759c..5edbfcc9 100644 --- a/src/comment.ts +++ b/src/comment.ts @@ -69,6 +69,7 @@ ${getReleasePlanMessage(releasePlan)} [Click here if you're a maintainer who wants to add a changeset to this MR](${addChangesetUrl}) +__Generated By Changesets Bot__ ` const getApproveMessage = ( @@ -87,6 +88,7 @@ Not sure what this means? [Click here to learn what changesets are](https://git [Click here if you're a maintainer who wants to add another changeset to this MR](${addChangesetUrl}) +__Generated By Changesets Bot__ ` const getNewChangesetTemplate = (changedPackages: string[], title: string) => @@ -100,7 +102,10 @@ ${title} const getCommentId = (api: Gitlab, mrIid: number | string) => api.MergeRequestNotes.all(context.projectId, mrIid).then(comments => { const changesetBotComment = comments.find( - comment => comment.author.username === process.env.GITLAB_CI_USER_NAME, + comment => + comment.author.username === process.env.GITLAB_CI_USER_NAME && + !comment.system && + comment.body.includes('Generated By Changesets Bot'), ) return changesetBotComment ? changesetBotComment.id : null }) From 721ae954b4d212395924ce06ce33290898d48a67 Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 00:56:47 +0330 Subject: [PATCH 04/11] fix: add the removeSourceBranch flag to merge requests to prevent duplicate branches fix: make checkout message check for general --- src/gitUtils.ts | 13 ++++++++----- src/run.ts | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gitUtils.ts b/src/gitUtils.ts index 17e22e75..33adb293 100644 --- a/src/gitUtils.ts +++ b/src/gitUtils.ts @@ -37,13 +37,16 @@ export const pushTags = async () => { } export const switchToMaybeExistingBranch = async (branch: string) => { - const { stderr } = await execWithOutput('git', ['checkout', branch], { + const { stdout, stderr } = await execWithOutput('git', ['checkout', branch], { ignoreReturnCode: true, }) - const isCreatingBranch = !stderr - .toString() - .includes(`Switched to a new branch '${branch}'`) - if (isCreatingBranch) { + + const shouldCreateBranch = !( + stderr.toString().includes(`Switched to`) || + stdout.toString().includes(`Switched to`) + ) + + if (shouldCreateBranch) { await exec('git', ['checkout', '-b', branch]) } } diff --git a/src/run.ts b/src/run.ts index 4f6f1a13..3e87e40c 100644 --- a/src/run.ts +++ b/src/run.ts @@ -298,12 +298,14 @@ ${ finalMrTitle, { description: await mrBodyPromise, + removeSourceBranch: true, }, ) } else { await api.MergeRequests.edit(context.projectId, searchResult[0].iid, { title: finalMrTitle, description: await mrBodyPromise, + removeSourceBranch: true, }) console.log('merge request found') } From 34b750d8de38e404e5a5e468a4a746e4b6f17906 Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 02:07:34 +0330 Subject: [PATCH 05/11] docs: update Readme --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f8062e2c..af387f85 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ release: #### With Yarn 2 / Plug'n'Play -If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI: +If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI. ```yml stages: @@ -175,3 +175,23 @@ release: variables: INPUT_VERSION: yarn changeset version ``` + +You may also want to run `yarn install` after the `changeset verion` command to update the yarn.lock in the version MR. You need to disable immutable lock file setting using an env variable. + +```yml +release: + image: node:lts-alpine + only: main + script: yarn changesets-gitlab + variables: + YARN_ENABLE_IMMUTABLE_INSTALLS: 'false' + INPUT_VERSION: yarn update-versions +``` + +And your `update-versions` script would be: + +```json +{ + "update-versions": "changeset version && yarn install" +} +``` From d227bd0d32db8fccc6a6b481c4513d80b7ca8c0e Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 18:02:29 +0330 Subject: [PATCH 06/11] docs: fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af387f85..c241f647 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ release: #### With Yarn 2 / Plug'n'Play -If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI. +If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI: ```yml stages: @@ -176,7 +176,7 @@ release: INPUT_VERSION: yarn changeset version ``` -You may also want to run `yarn install` after the `changeset verion` command to update the yarn.lock in the version MR. You need to disable immutable lock file setting using an env variable. +You may also want to run `yarn install` after the `changeset verion` command to update the yarn.lock in the version MR. You need to disable immutable lock file setting using an env variable: ```yml release: From 4cd124ee38c518fccff4b3b25e3eddb04d63968c Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 20:32:52 +0330 Subject: [PATCH 07/11] docs: update changesets --- .changeset/flat-chicken-repeat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/flat-chicken-repeat.md b/.changeset/flat-chicken-repeat.md index f9e9fc4d..62e8f79b 100644 --- a/.changeset/flat-chicken-repeat.md +++ b/.changeset/flat-chicken-repeat.md @@ -3,5 +3,5 @@ --- Add missing dependencies to the package.json -Add support for job tokens and oauth tokens (via GITLAB_TOKEN_TYPE config) +Add support for job tokens and oauth tokens (via GITLAB_TOKEN_TYPE config), The Gitlab job tokens have limited access to Gitlab package registry so we cannot use it until [this Epic](https://gitlab.com/groups/gitlab-org/-/epics/3559) gets resolved. Add eslintcache to gitignore From 8b5b46ccf66835c84e6ef8f9d24ed61f38a205b8 Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 20:34:25 +0330 Subject: [PATCH 08/11] docs: fix typo in changesets --- .changeset/flat-chicken-repeat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/flat-chicken-repeat.md b/.changeset/flat-chicken-repeat.md index 62e8f79b..cc1d2c78 100644 --- a/.changeset/flat-chicken-repeat.md +++ b/.changeset/flat-chicken-repeat.md @@ -3,5 +3,5 @@ --- Add missing dependencies to the package.json -Add support for job tokens and oauth tokens (via GITLAB_TOKEN_TYPE config), The Gitlab job tokens have limited access to Gitlab package registry so we cannot use it until [this Epic](https://gitlab.com/groups/gitlab-org/-/epics/3559) gets resolved. +Add support for job tokens and oauth tokens (via GITLAB_TOKEN_TYPE config), The Gitlab job tokens have limited access only to Gitlab package registry so we cannot use it until [this Epic](https://gitlab.com/groups/gitlab-org/-/epics/3559) gets implemented. Add eslintcache to gitignore From 0db28a2691bd3a487955c2aff36d69a7c6cf7d42 Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 20:58:17 +0330 Subject: [PATCH 09/11] fix: remove prepack script and npm-run-all dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 0cc202c6..4b80725a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "lint": "run-p lint:*", "lint:es": "eslint . --cache -f friendly", "lint:tsc": "tsc --noEmit", - "prepack": "yarn build:ts", "prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0", "prerelease": "yarn build", "release": "changeset publish", From 35b6d5ee1be5be654cec5f16d478da85229ce6bc Mon Sep 17 00:00:00 2001 From: Hossein Saniei Date: Sun, 21 Nov 2021 21:11:54 +0330 Subject: [PATCH 10/11] docs: better changesets --- .changeset/add-missing-deps.md | 5 +++++ .../{flat-chicken-repeat.md => add-token-type-support.md} | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .changeset/add-missing-deps.md rename .changeset/{flat-chicken-repeat.md => add-token-type-support.md} (79%) diff --git a/.changeset/add-missing-deps.md b/.changeset/add-missing-deps.md new file mode 100644 index 00000000..12604352 --- /dev/null +++ b/.changeset/add-missing-deps.md @@ -0,0 +1,5 @@ +--- +'changesets-gitlab': patch +--- + +Add missing dependencies to the package.json diff --git a/.changeset/flat-chicken-repeat.md b/.changeset/add-token-type-support.md similarity index 79% rename from .changeset/flat-chicken-repeat.md rename to .changeset/add-token-type-support.md index cc1d2c78..f3e6ee1b 100644 --- a/.changeset/flat-chicken-repeat.md +++ b/.changeset/add-token-type-support.md @@ -2,6 +2,4 @@ 'changesets-gitlab': minor --- -Add missing dependencies to the package.json Add support for job tokens and oauth tokens (via GITLAB_TOKEN_TYPE config), The Gitlab job tokens have limited access only to Gitlab package registry so we cannot use it until [this Epic](https://gitlab.com/groups/gitlab-org/-/epics/3559) gets implemented. -Add eslintcache to gitignore From 32d974bb97c0de84efb513dda5ee740e72a6bbd4 Mon Sep 17 00:00:00 2001 From: JounQin Date: Mon, 22 Nov 2021 08:02:24 +0000 Subject: [PATCH 11/11] refactor: improove code logic --- README.md | 2 +- src/comment.ts | 9 +++++---- src/gitUtils.ts | 11 +++-------- src/index.ts | 21 ++++++++------------- src/run.ts | 2 -- 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index c241f647..98a14545 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ release: INPUT_VERSION: yarn changeset version ``` -You may also want to run `yarn install` after the `changeset verion` command to update the yarn.lock in the version MR. You need to disable immutable lock file setting using an env variable: +You may also want to run `yarn install` after the `changeset verion` command to update the `yarn.lock` in the version MR. You need to disable immutable lock file setting using an env variable: ```yml release: diff --git a/src/comment.ts b/src/comment.ts index 5edbfcc9..7531f215 100644 --- a/src/comment.ts +++ b/src/comment.ts @@ -69,7 +69,7 @@ ${getReleasePlanMessage(releasePlan)} [Click here if you're a maintainer who wants to add a changeset to this MR](${addChangesetUrl}) -__Generated By Changesets Bot__ +__Generated By Changesets GitLab Bot__ ` const getApproveMessage = ( @@ -88,7 +88,7 @@ Not sure what this means? [Click here to learn what changesets are](https://git [Click here if you're a maintainer who wants to add another changeset to this MR](${addChangesetUrl}) -__Generated By Changesets Bot__ +__Generated By Changesets GitLab Bot__ ` const getNewChangesetTemplate = (changedPackages: string[], title: string) => @@ -104,8 +104,9 @@ const getCommentId = (api: Gitlab, mrIid: number | string) => const changesetBotComment = comments.find( comment => comment.author.username === process.env.GITLAB_CI_USER_NAME && - !comment.system && - comment.body.includes('Generated By Changesets Bot'), + // We need to ensure the comment is generated by us but we don't have a app bot like GitHub + // @see https://github.com/apps/changeset-bot + comment.body.includes('Generated By Changesets GitLab Bot'), ) return changesetBotComment ? changesetBotComment.id : null }) diff --git a/src/gitUtils.ts b/src/gitUtils.ts index 33adb293..08889d4f 100644 --- a/src/gitUtils.ts +++ b/src/gitUtils.ts @@ -37,16 +37,11 @@ export const pushTags = async () => { } export const switchToMaybeExistingBranch = async (branch: string) => { - const { stdout, stderr } = await execWithOutput('git', ['checkout', branch], { + const { stderr } = await execWithOutput('git', ['checkout', branch], { ignoreReturnCode: true, }) - - const shouldCreateBranch = !( - stderr.toString().includes(`Switched to`) || - stdout.toString().includes(`Switched to`) - ) - - if (shouldCreateBranch) { + const isCreatingBranch = !stderr.includes(`Switched to branch '${branch}'`) + if (isCreatingBranch) { await exec('git', ['checkout', '-b', branch]) } } diff --git a/src/index.ts b/src/index.ts index 7190fab1..766a5bbd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,9 +11,6 @@ declare global { } } -type ConstructorArgs = T extends new (...args: infer U) => any ? U : never -type GitlabConfig = ConstructorArgs[0] - export const createApi = (gitlabToken?: string) => { bootstrap() @@ -25,23 +22,21 @@ export const createApi = (gitlabToken?: string) => { } } - const config: GitlabConfig = { - host: process.env.GITLAB_HOST, - } - const token = gitlabToken || process.env.GITLAB_TOKEN + let tokenType: 'jobToken' | 'oauthToken' | 'token' = 'token' + switch (process.env.GITLAB_TOKEN_TYPE) { case 'job': - config.jobToken = token + tokenType = 'jobToken' break case 'oauth': - config.oauthToken = token - break - default: - config.token = token + tokenType = 'oauthToken' break } - return new Gitlab(config) + return new Gitlab({ + host: process.env.GITLAB_HOST, + [tokenType]: token, + }) } diff --git a/src/run.ts b/src/run.ts index 3e87e40c..4f6f1a13 100644 --- a/src/run.ts +++ b/src/run.ts @@ -298,14 +298,12 @@ ${ finalMrTitle, { description: await mrBodyPromise, - removeSourceBranch: true, }, ) } else { await api.MergeRequests.edit(context.projectId, searchResult[0].iid, { title: finalMrTitle, description: await mrBodyPromise, - removeSourceBranch: true, }) console.log('merge request found') }