From 0682fc9ce38535329579e719967aedb51b503f73 Mon Sep 17 00:00:00 2001 From: Technote Date: Tue, 24 Nov 2020 17:59:06 +0900 Subject: [PATCH 1/4] Revert "fix: checkout local branch" This reverts commit f540e45b321573c3aea98906e8b3b0d2276795cb. --- __tests__/utils/command.test.ts | 2 -- __tests__/utils/process1.test.ts | 11 ---------- __tests__/utils/process2.test.ts | 35 -------------------------------- src/utils/command.ts | 14 ++----------- 4 files changed, 2 insertions(+), 60 deletions(-) diff --git a/__tests__/utils/command.test.ts b/__tests__/utils/command.test.ts index 8d9c691..b4837be 100644 --- a/__tests__/utils/command.test.ts +++ b/__tests__/utils/command.test.ts @@ -158,8 +158,6 @@ describe('checkBranch', () => { }))).toBe(false); execCalledWith(mockExec, [ - 'git rev-parse --abbrev-ref HEAD || :', - 'git checkout hello-world/test-branch || :', 'git rev-parse --abbrev-ref HEAD || :', 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', diff --git a/__tests__/utils/process1.test.ts b/__tests__/utils/process1.test.ts index 89a40aa..86d00cd 100644 --- a/__tests__/utils/process1.test.ts +++ b/__tests__/utils/process1.test.ts @@ -202,9 +202,6 @@ describe('execute', () => { '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout Hello-World/test-21031067', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: test', '::endgroup::', @@ -287,10 +284,6 @@ describe('execute', () => { ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> stdout', - '[command]git checkout Hello-World/test-21031067', - ' >> stdout', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> stdout', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: stdout', '::endgroup::', @@ -635,10 +628,6 @@ describe('execute', () => { ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> stdout', - '[command]git checkout Hello-World/test-21031067', - ' >> stdout', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> stdout', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: stdout', '::endgroup::', diff --git a/__tests__/utils/process2.test.ts b/__tests__/utils/process2.test.ts index e1f24ba..b60c76b 100644 --- a/__tests__/utils/process2.test.ts +++ b/__tests__/utils/process2.test.ts @@ -122,9 +122,6 @@ describe('execute', () => { '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout Hello-World/test-21031067', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: test', '::endgroup::', @@ -207,9 +204,6 @@ describe('execute', () => { '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout Hello-World/test-21031067', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: test', '::endgroup::', @@ -289,9 +283,6 @@ describe('execute', () => { '[command]git checkout -b test/test-1 origin/test/test-1', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout test/test-1', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [test/test-1] not found.', '> now branch: test', '> Cloning [change/new-topic1] from the remote repo...', @@ -318,9 +309,6 @@ describe('execute', () => { '[command]git checkout -b test/test-2 origin/test/test-2', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout test/test-2', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [test/test-2] not found.', '> now branch: test', '> Cloning [change/new-topic2] from the remote repo...', @@ -395,9 +383,6 @@ describe('execute', () => { '[command]git checkout -b test/test-branch origin/test/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout test/test-branch', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [test/test-branch] not found.', '> now branch: test', '> Cloning [change/new-topic1] from the remote repo...', @@ -806,9 +791,6 @@ describe('execute', () => { '[command]git checkout -b Hello-World/test-branch origin/Hello-World/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout Hello-World/test-branch', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [Hello-World/test-branch] not found.', '> now branch: test', '> Cloning [feature/new-topic3] from the remote repo...', @@ -1068,9 +1050,6 @@ describe('execute', () => { '[command]git checkout -b master origin/master', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout master', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [master] not found.', '> now branch: test', '> Cloning [master] from the remote repo...', @@ -1148,9 +1127,6 @@ describe('execute', () => { '[command]git checkout -b Hello-World/test-branch origin/Hello-World/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout Hello-World/test-branch', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [Hello-World/test-branch] not found.', '> now branch: test', '> Cloning [feature/new-topic3] from the remote repo...', @@ -1255,9 +1231,6 @@ describe('execute', () => { '[command]git checkout -b change/test-0 origin/change/test-0', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', - '[command]git checkout change/test-0', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> change/new-topic1', '> remote branch [change/test-0] not found.', '> now branch: change/new-topic1', '> Cloning [master] from the remote repo...', @@ -1331,9 +1304,6 @@ describe('execute', () => { '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', - '[command]git checkout Hello-World/test-21031067', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> test', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: test', '::endgroup::', @@ -1392,7 +1362,6 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [test/change]...', '[command]git checkout -b test/change origin/test/change', - '[command]git checkout test/change', ]); }); @@ -1556,10 +1525,6 @@ describe('execute', () => { ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> stdout', - '[command]git checkout Hello-World/test-21031067', - ' >> stdout', - '[command]git rev-parse --abbrev-ref HEAD', - ' >> stdout', '> remote branch [Hello-World/test-21031067] not found.', '> now branch: stdout', '::endgroup::', diff --git a/src/utils/command.ts b/src/utils/command.ts index 7b56f99..3b312ac 100644 --- a/src/utils/command.ts +++ b/src/utils/command.ts @@ -50,18 +50,8 @@ export const clone = async(helper: GitHelper, logger: Logger, octokit: Octokit, }; export const checkBranch = async(helper: GitHelper, logger: Logger, octokit: Octokit, context: ActionContext): Promise => { - let clonedBranch = await helper.getCurrentBranchName(getWorkspace()); - const branchName = await getPrBranchName(helper, octokit, context); - if (branchName !== clonedBranch) { - await helper.runCommand(getWorkspace(), { - command: 'git checkout', - args: [branchName], - suppressError: true, - stderrToStdout: true, - }); - clonedBranch = await helper.getCurrentBranchName(getWorkspace()); - } - + const clonedBranch = await helper.getCurrentBranchName(getWorkspace()); + const branchName = await getPrBranchName(helper, octokit, context); if (branchName === clonedBranch) { await helper.runCommand(getWorkspace(), { From ab64612caddfe43343e2fcee34978576e0904cee Mon Sep 17 00:00:00 2001 From: Technote Date: Tue, 24 Nov 2020 19:27:28 +0900 Subject: [PATCH 2/4] chore: update packages --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8b901ca..81d6097 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@actions/core": "^1.2.6", "@actions/github": "^4.0.0", "@technote-space/filter-github-action": "^0.5.8", - "@technote-space/github-action-helper": "^4.3.1", + "@technote-space/github-action-helper": "^4.3.2", "moment": "^2.29.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index ea47076..9bd9980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -772,10 +772,10 @@ "@actions/core" "^1.2.6" "@actions/github" "^4.0.0" -"@technote-space/github-action-helper@^4.3.1": - version "4.3.1" - resolved "https://registry.yarnpkg.com/@technote-space/github-action-helper/-/github-action-helper-4.3.1.tgz#e079ae025b174bc77de07a03d698361f29a43dbf" - integrity sha512-hYfo9Oxx/mX114AJy66p75B8wK69/59f7wIfAh8Ck4Jnv22LtRFMUgkRwnD9+q1ob777UwBqFcykXOSYdHfKQg== +"@technote-space/github-action-helper@^4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@technote-space/github-action-helper/-/github-action-helper-4.3.2.tgz#2c6650357713c50e23e7253de107361dd938e833" + integrity sha512-W0OTx9qVU3cY3Nc22VTluVJJWMQg4RzLARsNmZt/0A8qTvFwAAoxr0GBHW55VFsYHLNW4OOOElex1Tl1rBxzZA== dependencies: "@actions/core" "^1.2.6" "@actions/github" "^4.0.0" From ffb778e71dff2d786860e11f5fae9c3789bc1309 Mon Sep 17 00:00:00 2001 From: Technote Date: Tue, 24 Nov 2020 19:37:19 +0900 Subject: [PATCH 3/4] fix: broken tests --- __tests__/utils/command.test.ts | 9 +++++++ __tests__/utils/process1.test.ts | 13 +++++++++++ __tests__/utils/process2.test.ts | 40 ++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) diff --git a/__tests__/utils/command.test.ts b/__tests__/utils/command.test.ts index b4837be..ce46ff4 100644 --- a/__tests__/utils/command.test.ts +++ b/__tests__/utils/command.test.ts @@ -108,6 +108,7 @@ describe('clone', () => { 'git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\' || :', 'git reset --hard || :', 'git checkout -b hello-world/test-branch origin/hello-world/test-branch || :', + 'git checkout hello-world/test-branch || :', ]); stdoutCalledWith(mockStdout, [ '::group::Fetching...', @@ -122,6 +123,8 @@ describe('clone', () => { '::group::Switching branch to [hello-world/test-branch]...', '[command]git checkout -b hello-world/test-branch origin/hello-world/test-branch', ' >> stdout', + '[command]git checkout hello-world/test-branch', + ' >> stdout', ]); }); }); @@ -162,6 +165,7 @@ describe('checkBranch', () => { 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', 'git checkout -b feature/new-feature origin/feature/new-feature || :', + 'git checkout feature/new-feature || :', 'git checkout -b hello-world/test-branch', 'ls -la', ]); @@ -366,6 +370,7 @@ describe('getChangedFiles', () => { '::endgroup::', '::group::Switching branch to [hello-world/test-branch]...', '[command]git checkout -b hello-world/test-branch origin/hello-world/test-branch', + '[command]git checkout hello-world/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> hello-world/test-branch', '[command]git merge --no-edit origin/hello-world/test-branch', @@ -450,6 +455,7 @@ describe('getChangedFiles', () => { '::endgroup::', '::group::Switching branch to [hello-world/test-branch]...', '[command]git checkout -b hello-world/test-branch origin/hello-world/test-branch', + '[command]git checkout hello-world/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> hello-world/test-branch', '[command]git merge --no-edit origin/hello-world/test-branch', @@ -563,6 +569,7 @@ describe('getChangedFiles', () => { '::endgroup::', '::group::Switching branch to [hello-world/test-branch]...', '[command]git checkout -b hello-world/test-branch origin/hello-world/test-branch', + '[command]git checkout hello-world/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> hello-world/test-branch', '[command]git merge --no-edit origin/hello-world/test-branch', @@ -872,6 +879,7 @@ describe('resolveConflicts', () => { 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', 'git checkout -b feature/new-feature origin/feature/new-feature || :', + 'git checkout feature/new-feature || :', 'git checkout -b hello-world/test-branch', 'yarn upgrade', 'git add --all', @@ -925,6 +933,7 @@ describe('resolveConflicts', () => { 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', 'git checkout -b feature/new-feature origin/feature/new-feature || :', + 'git checkout feature/new-feature || :', 'git checkout -b hello-world/test-branch', 'yarn upgrade', 'git add --all', diff --git a/__tests__/utils/process1.test.ts b/__tests__/utils/process1.test.ts index 86d00cd..3ce07f8 100644 --- a/__tests__/utils/process1.test.ts +++ b/__tests__/utils/process1.test.ts @@ -120,6 +120,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -200,6 +201,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', + '[command]git checkout Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [Hello-World/test-21031067] not found.', @@ -209,6 +211,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', '[command]git checkout -b feature/new-feature origin/feature/new-feature', + '[command]git checkout feature/new-feature', '[command]git checkout -b Hello-World/test-21031067', '[command]ls -la', '::endgroup::', @@ -282,6 +285,8 @@ describe('execute', () => { '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', ' >> stdout', + '[command]git checkout Hello-World/test-21031067', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> stdout', '> remote branch [Hello-World/test-21031067] not found.', @@ -293,6 +298,8 @@ describe('execute', () => { ' >> stdout', '[command]git checkout -b feature/new-feature origin/feature/new-feature', ' >> stdout', + '[command]git checkout feature/new-feature', + ' >> stdout', '[command]git checkout -b Hello-World/test-21031067', ' >> stdout', '[command]ls -la', @@ -420,6 +427,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -626,6 +634,8 @@ describe('execute', () => { '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', ' >> stdout', + '[command]git checkout Hello-World/test-21031067', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> stdout', '> remote branch [Hello-World/test-21031067] not found.', @@ -637,6 +647,8 @@ describe('execute', () => { ' >> stdout', '[command]git checkout -b feature/new-feature origin/feature/new-feature', ' >> stdout', + '[command]git checkout feature/new-feature', + ' >> stdout', '[command]git checkout -b Hello-World/test-21031067', ' >> stdout', '[command]ls -la', @@ -688,6 +700,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [test/change]...', '[command]git checkout -b test/change origin/test/change', + '[command]git checkout test/change', '[command]git rev-parse --abbrev-ref HEAD', ' >> test/change', '[command]git merge --no-edit origin/test/change', diff --git a/__tests__/utils/process2.test.ts b/__tests__/utils/process2.test.ts index b60c76b..585782d 100644 --- a/__tests__/utils/process2.test.ts +++ b/__tests__/utils/process2.test.ts @@ -120,6 +120,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', + '[command]git checkout Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [Hello-World/test-21031067] not found.', @@ -129,6 +130,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', '[command]git checkout -b feature/new-feature origin/feature/new-feature', + '[command]git checkout feature/new-feature', '[command]git checkout -b Hello-World/test-21031067', '[command]ls -la', '::endgroup::', @@ -202,6 +204,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', + '[command]git checkout Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [Hello-World/test-21031067] not found.', @@ -211,6 +214,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', '[command]git checkout -b feature/new-feature origin/feature/new-feature', + '[command]git checkout feature/new-feature', '[command]git checkout -b Hello-World/test-21031067', '[command]ls -la', '::endgroup::', @@ -281,6 +285,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [test/test-1]...', '[command]git checkout -b test/test-1 origin/test/test-1', + '[command]git checkout test/test-1', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [test/test-1] not found.', @@ -289,6 +294,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git checkout -b test/test-1', '[command]ls -la', '> Running commands...', @@ -307,6 +313,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [test/test-2]...', '[command]git checkout -b test/test-2 origin/test/test-2', + '[command]git checkout test/test-2', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [test/test-2] not found.', @@ -315,6 +322,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic2:refs/remotes/origin/change/new-topic2\'', '[command]git checkout -b change/new-topic2 origin/change/new-topic2', + '[command]git checkout change/new-topic2', '[command]git checkout -b test/test-2', '[command]ls -la', '> Running commands...', @@ -381,6 +389,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [test/test-branch]...', '[command]git checkout -b test/test-branch origin/test/test-branch', + '[command]git checkout test/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [test/test-branch] not found.', @@ -389,6 +398,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git checkout -b test/test-branch', '[command]ls -la', '> Running commands...', @@ -469,6 +479,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -535,6 +546,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [test]...', '[command]git checkout -b test origin/test', + '[command]git checkout test', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '[command]git merge --no-edit origin/test', @@ -605,6 +617,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [feature/new-feature]...', '[command]git checkout -b feature/new-feature origin/feature/new-feature', + '[command]git checkout feature/new-feature', '[command]git rev-parse --abbrev-ref HEAD', ' >> feature/new-feature', '[command]git merge --no-edit origin/feature/new-feature', @@ -695,6 +708,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -789,6 +803,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [Hello-World/test-branch]...', '[command]git checkout -b Hello-World/test-branch origin/Hello-World/test-branch', + '[command]git checkout Hello-World/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [Hello-World/test-branch] not found.', @@ -797,6 +812,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/feature/new-topic3:refs/remotes/origin/feature/new-topic3\'', '[command]git checkout -b feature/new-topic3 origin/feature/new-topic3', + '[command]git checkout feature/new-topic3', '[command]git checkout -b Hello-World/test-branch', '[command]ls -la', '> Running commands...', @@ -872,6 +888,8 @@ describe('execute', () => { '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', ' >> stdout', + '[command]git checkout change/new-topic1', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -954,6 +972,8 @@ describe('execute', () => { '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', ' >> stdout', + '[command]git checkout change/new-topic1', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -1048,6 +1068,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [master]...', '[command]git checkout -b master origin/master', + '[command]git checkout master', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [master] not found.', @@ -1056,6 +1077,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'', '[command]git checkout -b master origin/master', + '[command]git checkout master', '[command]git checkout -b master', '[command]ls -la', '> Running commands...', @@ -1125,6 +1147,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [Hello-World/test-branch]...', '[command]git checkout -b Hello-World/test-branch origin/Hello-World/test-branch', + '[command]git checkout Hello-World/test-branch', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [Hello-World/test-branch] not found.', @@ -1133,6 +1156,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/feature/new-topic3:refs/remotes/origin/feature/new-topic3\'', '[command]git checkout -b feature/new-topic3 origin/feature/new-topic3', + '[command]git checkout feature/new-topic3', '[command]git checkout -b Hello-World/test-branch', '[command]ls -la', '> Running commands...', @@ -1202,6 +1226,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', + '[command]git checkout change/new-topic1', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -1229,6 +1254,7 @@ describe('execute', () => { '[command]git reset --hard', '> Switching branch to [change/test-0]...', '[command]git checkout -b change/test-0 origin/change/test-0', + '[command]git checkout change/test-0', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '> remote branch [change/test-0] not found.', @@ -1237,6 +1263,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'', '[command]git checkout -b master origin/master', + '[command]git checkout master', '[command]git checkout -b change/test-0', '[command]ls -la', '> Running commands...', @@ -1302,6 +1329,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', + '[command]git checkout Hello-World/test-21031067', '[command]git rev-parse --abbrev-ref HEAD', ' >> test', '> remote branch [Hello-World/test-21031067] not found.', @@ -1311,6 +1339,7 @@ describe('execute', () => { '[command]git remote add origin', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', '[command]git checkout -b feature/new-feature origin/feature/new-feature', + '[command]git checkout feature/new-feature', '[command]git checkout -b Hello-World/test-21031067', '[command]ls -la', '::endgroup::', @@ -1362,6 +1391,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [test/change]...', '[command]git checkout -b test/change origin/test/change', + '[command]git checkout test/change', ]); }); @@ -1401,6 +1431,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [test/change]...', '[command]git checkout -b test/change origin/test/change', + '[command]git checkout test/change', '[command]git rev-parse --abbrev-ref HEAD', ' >> test/change', '[command]git merge --no-edit origin/test/change', @@ -1459,6 +1490,7 @@ describe('execute', () => { '::endgroup::', '::group::Switching branch to [test/change]...', '[command]git checkout -b test/change origin/test/change', + '[command]git checkout test/change', '[command]git rev-parse --abbrev-ref HEAD', ' >> test/change', '[command]git merge --no-edit origin/test/change', @@ -1523,6 +1555,8 @@ describe('execute', () => { '::group::Switching branch to [Hello-World/test-21031067]...', '[command]git checkout -b Hello-World/test-21031067 origin/Hello-World/test-21031067', ' >> stdout', + '[command]git checkout Hello-World/test-21031067', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> stdout', '> remote branch [Hello-World/test-21031067] not found.', @@ -1534,6 +1568,8 @@ describe('execute', () => { ' >> stdout', '[command]git checkout -b feature/new-feature origin/feature/new-feature', ' >> stdout', + '[command]git checkout feature/new-feature', + ' >> stdout', '[command]git checkout -b Hello-World/test-21031067', ' >> stdout', '[command]ls -la', @@ -1629,6 +1665,8 @@ describe('execute', () => { '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', ' >> stdout', + '[command]git checkout change/new-topic1', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', @@ -1728,6 +1766,8 @@ describe('execute', () => { '> Switching branch to [change/new-topic1]...', '[command]git checkout -b change/new-topic1 origin/change/new-topic1', ' >> stdout', + '[command]git checkout change/new-topic1', + ' >> stdout', '[command]git rev-parse --abbrev-ref HEAD', ' >> change/new-topic1', '[command]git merge --no-edit origin/change/new-topic1', From 4dc3339226d058bd711a610c1eec755c6d2bb6da Mon Sep 17 00:00:00 2001 From: Technote Date: Tue, 24 Nov 2020 19:40:07 +0900 Subject: [PATCH 4/4] feat: update package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 81d6097..b4c1041 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@technote-space/github-action-pr-helper", - "version": "2.0.2", + "version": "2.0.3", "description": "PullRequest Helper for GitHub Actions.", "keywords": [ "github",