Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b5afb8

Browse files
fix: cannot find remote branch
1 parent 2dea7f0 commit 5b5afb8

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26275,7 +26275,7 @@ var main = async () => {
2627526275
const maxDepth = core.getInput("max_depth") || 9;
2627626276
const customFileColors = JSON.parse(core.getInput("file_colors") || "{}");
2627726277
const colorEncoding = core.getInput("color_encoding") || "type";
26278-
const commitMessage = core.getInput("commit_message") || "Repo visualizer: updated diagram";
26278+
const commitMessage = core.getInput("commit_message") || "Repo visualizer: update diagram";
2627926279
const excludedPathsString = core.getInput("excluded_paths") || "node_modules,bower_components,dist,out,build,eject,.next,.netlify,.yarn,.git,.vscode,package-lock.json,yarn.lock";
2628026280
const excludedPaths = excludedPathsString.split(",").map((str) => str.trim());
2628126281
const excludedGlobsString = core.getInput("excluded_globs") || "";
@@ -26295,8 +26295,7 @@ var main = async () => {
2629526295
if (branch) {
2629626296
await (0, import_exec.exec)("git", ["fetch"]);
2629726297
try {
26298-
await (0, import_exec.exec)("git", ["rev-parse", "--verify", branch]);
26299-
await (0, import_exec.exec)("git", ["checkout", branch]);
26298+
await (0, import_exec.exec)("git", ["switch", "-c", branch, "--track", `origin/${branch}`]);
2630026299
} catch {
2630126300
doesBranchExist = false;
2630226301
core.info(`Branch ${branch} does not yet exist, creating ${branch}.`);

src/index.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ const main = async () => {
5454
await exec('git', ['fetch'])
5555

5656
try {
57-
await exec('git', ['rev-parse', '--verify', branch])
58-
await exec('git', ['checkout', branch])
57+
await exec('git', ['switch', '-c' , branch,'--track', `origin/${branch}`])
5958
} catch {
6059
doesBranchExist = false
6160
core.info(`Branch ${branch} does not yet exist, creating ${branch}.`)

0 commit comments

Comments
 (0)