diff --git a/dist/build-crates-standalone-main.js b/dist/build-crates-standalone-main.js index c3b836f..db738f4 100644 --- a/dist/build-crates-standalone-main.js +++ b/dist/build-crates-standalone-main.js @@ -127657,8 +127657,9 @@ const gitEnv = { function cloneFromGitHub(repo, options) { const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`; - const command = ["git", "clone", "--recursive", "--single-branch"]; + const command = ["git", "clone", "--recursive"]; if (options.branch != undefined) { + command.push("--single-branch"); command.push("--branch", options.branch); } command.push(remote); diff --git a/dist/create-release-branch-main.js b/dist/create-release-branch-main.js index 4361dea..e84d2ab 100644 --- a/dist/create-release-branch-main.js +++ b/dist/create-release-branch-main.js @@ -24820,8 +24820,9 @@ function exec(program, args, options) { function cloneFromGitHub(repo, options) { const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`; - const command = ["git", "clone", "--recursive", "--single-branch"]; + const command = ["git", "clone", "--recursive"]; if (options.branch != undefined) { + command.push("--single-branch"); command.push("--branch", options.branch); } command.push(remote); @@ -24871,16 +24872,20 @@ async function main(input) { else { branch = `release/dry-run/${version}`; lib_core.setOutput("branch", branch); - const refsPattern = "refs/remotes/origin/release/dry-run"; + const branchPattern = "refs/remotes/origin/release/dry-run"; // for some reason using the full refname won't work to delete the remote branch, so // refname:strip=3 removes 'refs/remotes/origin' from the pattern to have the branch name only. - const refsRaw = command_sh(`git for-each-ref --format='%(refname:strip=3)' --sort=authordate ${refsPattern}`, { + const branchesRaw = command_sh(`git for-each-ref --format='%(refname:strip=3)' --sort=authordate ${branchPattern}`, { cwd: repo, }); - const refs = refsRaw.split("\n"); - if (refs.length >= input.dryRunHistorySize) { - const toDelete = refs.slice(0, refs.length - input.dryRunHistorySize); - toDelete.forEach(ref => command_sh(`git push origin --delete ${ref}`, { cwd: repo })); + const branches = branchesRaw.split("\n"); + if (branches.length >= input.dryRunHistorySize) { + const toDelete = branches.slice(0, branches.length - input.dryRunHistorySize); + toDelete.forEach(branch => { + const tag = branch.replace("release/dry-run/", ""); + command_sh(`git push origin --delete ${branch}`, { cwd: repo }); + command_sh(`git push origin --delete ${tag}`, { cwd: repo }); + }); } } command_sh(`git switch --force-create ${branch}`, { cwd: repo }); diff --git a/dist/publish-crates-eclipse-main.js b/dist/publish-crates-eclipse-main.js index e6ac9de..93018c9 100644 --- a/dist/publish-crates-eclipse-main.js +++ b/dist/publish-crates-eclipse-main.js @@ -127751,8 +127751,9 @@ const gitEnv = { function cloneFromGitHub(repo, options) { const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`; - const command = ["git", "clone", "--recursive", "--single-branch"]; + const command = ["git", "clone", "--recursive"]; if (options.branch != undefined) { + command.push("--single-branch"); command.push("--branch", options.branch); } command.push(remote); diff --git a/dist/publish-crates-github-main.js b/dist/publish-crates-github-main.js index 6395a4c..9f77262 100644 --- a/dist/publish-crates-github-main.js +++ b/dist/publish-crates-github-main.js @@ -127730,8 +127730,9 @@ const gitEnv = { function cloneFromGitHub(repo, options) { const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`; - const command = ["git", "clone", "--recursive", "--single-branch"]; + const command = ["git", "clone", "--recursive"]; if (options.branch != undefined) { + command.push("--single-branch"); command.push("--branch", options.branch); } command.push(remote); diff --git a/dist/publish-crates-homebrew-main.js b/dist/publish-crates-homebrew-main.js index 711dc5c..f79d66c 100644 --- a/dist/publish-crates-homebrew-main.js +++ b/dist/publish-crates-homebrew-main.js @@ -127654,8 +127654,9 @@ const gitEnv = { function cloneFromGitHub(repo, options) { const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`; - const command = ["git", "clone", "--recursive", "--single-branch"]; + const command = ["git", "clone", "--recursive"]; if (options.branch != undefined) { + command.push("--single-branch"); command.push("--branch", options.branch); } command.push(remote); diff --git a/src/create-release-branch.ts b/src/create-release-branch.ts index 3c80467..5876fcc 100644 --- a/src/create-release-branch.ts +++ b/src/create-release-branch.ts @@ -52,17 +52,21 @@ export async function main(input: Input) { branch = `release/dry-run/${version}`; core.setOutput("branch", branch); - const refsPattern = "refs/remotes/origin/release/dry-run"; + const branchPattern = "refs/remotes/origin/release/dry-run"; // for some reason using the full refname won't work to delete the remote branch, so // refname:strip=3 removes 'refs/remotes/origin' from the pattern to have the branch name only. - const refsRaw = sh(`git for-each-ref --format='%(refname:strip=3)' --sort=authordate ${refsPattern}`, { + const branchesRaw = sh(`git for-each-ref --format='%(refname:strip=3)' --sort=authordate ${branchPattern}`, { cwd: repo, }); - const refs = refsRaw.split("\n"); + const branches = branchesRaw.split("\n"); - if (refs.length >= input.dryRunHistorySize) { - const toDelete = refs.slice(0, refs.length - input.dryRunHistorySize); - toDelete.forEach(ref => sh(`git push origin --delete ${ref}`, { cwd: repo })); + if (branches.length >= input.dryRunHistorySize) { + const toDelete = branches.slice(0, branches.length - input.dryRunHistorySize); + toDelete.forEach(branch => { + const tag = branch.replace("release/dry-run/", ""); + sh(`git push origin --delete ${branch}`, { cwd: repo }); + sh(`git push origin --delete ${tag}`, { cwd: repo }); + }); } } diff --git a/src/git.ts b/src/git.ts index ef11992..42b937b 100644 --- a/src/git.ts +++ b/src/git.ts @@ -10,8 +10,9 @@ export function cloneFromGitHub(repo: string, options: CloneFromGitHubOptions) { const remote = options.token == undefined ? `https://github.com/${repo}.git` : `https://${options.token}@github.com/${repo}.git`; - const command = ["git", "clone", "--recursive", "--single-branch"]; + const command = ["git", "clone", "--recursive"]; if (options.branch != undefined) { + command.push("--single-branch"); command.push("--branch", options.branch); } command.push(remote);