From b1bb2aaf611d9f2e5d1900c06493769b9f102a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Brauer?= Date: Wed, 29 Jun 2022 11:22:26 +0200 Subject: [PATCH] Use clone URL provided from the payload to support GHES (#89) --- package.json | 2 +- src/backport.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 91a3192..c082654 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backport", - "version": "2.0.2", + "version": "2.0.3", "license": "MIT", "main": "dist/index.js", "files": [ diff --git a/src/backport.ts b/src/backport.ts index 61242cc..3a0ee8d 100644 --- a/src/backport.ts +++ b/src/backport.ts @@ -251,10 +251,11 @@ const backport = async ({ info(`Backporting ${mergeCommitSha} from #${number}.`); - await exec("git", [ - "clone", - `https://x-access-token:${token}@github.com/${owner}/${repo}.git`, - ]); + const cloneUrl = new URL(payload.repository.clone_url); + cloneUrl.username = "x-access-token"; + cloneUrl.password = token; + + await exec("git", ["clone", cloneUrl.toString()]); await exec("git", [ "config", "--global",