diff --git a/__tests__/utils/command.test.ts b/__tests__/utils/command.test.ts index ce46ff4..63d7c63 100644 --- a/__tests__/utils/command.test.ts +++ b/__tests__/utils/command.test.ts @@ -104,7 +104,7 @@ describe('clone', () => { execCalledWith(mockExec, [ 'git init \'.\'', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', '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 || :', @@ -115,6 +115,7 @@ describe('clone', () => { '[command]git init \'.\'', ' >> stdout', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'', ' >> stdout', '[command]git reset --hard', @@ -162,7 +163,7 @@ describe('checkBranch', () => { execCalledWith(mockExec, [ 'git rev-parse --abbrev-ref HEAD || :', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', '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 || :', @@ -707,6 +708,7 @@ describe('updatePr', () => { '::endgroup::', '::group::Pushing to hello/world@test...', '[command]git push origin test:refs/heads/test', + ' >> stdout', ]); }); }); @@ -834,12 +836,12 @@ describe('resolveConflicts', () => { execCalledWith(mockExec, [ 'git init \'.\'', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', 'git config \'user.name\' \'GitHub Actions\'', 'git config \'user.email\' \'example@example.com\'', 'git merge --no-edit origin/feature/new-feature || :', - 'git push origin \'test:refs/heads/test\' > /dev/null 2>&1 || :', + 'git push origin \'test:refs/heads/test\' || :', ]); }); @@ -869,14 +871,14 @@ describe('resolveConflicts', () => { execCalledWith(mockExec, [ 'git init \'.\'', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', 'git config \'user.name\' \'GitHub Actions\'', 'git config \'user.email\' \'example@example.com\'', 'git merge --no-edit origin/feature/new-feature || :', `rm -rdf ${workDir}`, 'git init \'.\'', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', '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 || :', @@ -923,14 +925,14 @@ describe('resolveConflicts', () => { execCalledWith(mockExec, [ 'git init \'.\'', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', 'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :', 'git config \'user.name\' \'GitHub Actions\'', 'git config \'user.email\' \'example@example.com\'', 'git merge --no-edit origin/feature/new-feature || :', `rm -rdf ${workDir}`, 'git init \'.\'', - 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' > /dev/null 2>&1 || :', + 'git remote add origin \'https://octocat:test-token@github.com/hello/world.git\' || :', '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 || :', @@ -942,7 +944,7 @@ describe('resolveConflicts', () => { 'git config \'user.email\' \'example@example.com\'', 'git commit -qm \'commit message\'', 'git show \'--stat-count=10\' HEAD', - 'git push --force origin \'test:refs/heads/test\' > /dev/null 2>&1 || :', + 'git push --force origin \'test:refs/heads/test\' || :', ]); }); }); diff --git a/__tests__/utils/process1.test.ts b/__tests__/utils/process1.test.ts index 3ce07f8..e6b5068 100644 --- a/__tests__/utils/process1.test.ts +++ b/__tests__/utils/process1.test.ts @@ -137,7 +137,7 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', '[command]git diff \'HEAD..origin/master\' --name-only', '> Closing PullRequest... [change/new-topic1]', '> Deleting reference... [refs/heads/change/new-topic1]', @@ -229,7 +229,7 @@ describe('execute', () => { '[command]git show \'--stat-count=10\' HEAD', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::endgroup::', '::group::Closing PullRequest... [Hello-World/test-21031067]', @@ -277,6 +277,7 @@ describe('execute', () => { stdoutCalledWith(mockStdout, [ '::group::Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/Hello-World/test-21031067:refs/remotes/origin/Hello-World/test-21031067\'', ' >> stdout', '[command]git reset --hard', @@ -294,6 +295,7 @@ describe('execute', () => { '::endgroup::', '::group::Cloning [feature/new-feature] from the remote repo...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', ' >> stdout', '[command]git checkout -b feature/new-feature origin/feature/new-feature', @@ -316,7 +318,8 @@ describe('execute', () => { '> There is no diff.', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + ' >> stdout', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::endgroup::', '::group::Closing PullRequest... [Hello-World/test-21031067]', @@ -448,7 +451,7 @@ describe('execute', () => { '[command]git commit -qm \'test: create pull request\'', '[command]git show \'--stat-count=10\' HEAD', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', '[command]git diff \'HEAD..origin/master\' --name-only', '> Closing PullRequest... [change/new-topic1]', '> Deleting reference... [refs/heads/change/new-topic1]', @@ -626,6 +629,7 @@ describe('execute', () => { stdoutCalledWith(mockStdout, [ '::group::Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/Hello-World/test-21031067:refs/remotes/origin/Hello-World/test-21031067\'', ' >> stdout', '[command]git reset --hard', @@ -643,6 +647,7 @@ describe('execute', () => { '::endgroup::', '::group::Cloning [feature/new-feature] from the remote repo...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', ' >> stdout', '[command]git checkout -b feature/new-feature origin/feature/new-feature', @@ -665,7 +670,8 @@ describe('execute', () => { '> There is no diff.', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + ' >> stdout', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::set-output name=result::not changed', '::endgroup::', diff --git a/__tests__/utils/process2.test.ts b/__tests__/utils/process2.test.ts index 585782d..717adc5 100644 --- a/__tests__/utils/process2.test.ts +++ b/__tests__/utils/process2.test.ts @@ -148,7 +148,7 @@ describe('execute', () => { '[command]git show \'--stat-count=10\' HEAD', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::endgroup::', '::group::Pushing to octocat/Hello-World@Hello-World/test-21031067...', @@ -227,7 +227,7 @@ describe('execute', () => { '> There is no diff.', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::set-output name=result::not changed', '::endgroup::', @@ -303,7 +303,7 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1', '[command]git diff \'HEAD..origin/change/new-topic1\' --name-only', '::endgroup::', '::group::Target PullRequest Ref [change/new-topic2]', @@ -331,7 +331,7 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/change/new-topic2:refs/remotes/origin/change/new-topic2', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/change/new-topic2:refs/remotes/origin/change/new-topic2', '[command]git diff \'HEAD..origin/change/new-topic2\' --name-only', '::endgroup::', '::group::Total:2 Succeeded:0 Failed:0 Skipped:2', @@ -411,7 +411,7 @@ describe('execute', () => { '[command]git commit -qm \'test: create pull request\'', '[command]git show \'--stat-count=10\' HEAD', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1', '[command]git diff \'HEAD..origin/change/new-topic1\' --name-only', '::endgroup::', '::group::Total:2 Succeeded:0 Failed:0 Skipped:2', @@ -500,7 +500,7 @@ describe('execute', () => { '[command]git commit -qm \'test: create pull request\'', '[command]git show \'--stat-count=10\' HEAD', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', '[command]git diff \'HEAD..origin/master\' --name-only', '::endgroup::', '::group::Target PullRequest Ref [change/new-topic2]', @@ -729,7 +729,7 @@ describe('execute', () => { '[command]git commit -qm \'test: create pull request\'', '[command]git show \'--stat-count=10\' HEAD', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', '[command]git diff \'HEAD..origin/master\' --name-only', '> Pushing to octocat/Hello-World@change/new-topic1...', '[command]git push origin change/new-topic1:refs/heads/change/new-topic1', @@ -826,7 +826,7 @@ describe('execute', () => { '[command]git commit -qm \'test: create pull request\'', '[command]git show \'--stat-count=10\' HEAD', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-topic3:refs/remotes/origin/feature/new-topic3', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-topic3:refs/remotes/origin/feature/new-topic3', '[command]git diff \'HEAD..origin/feature/new-topic3\' --name-only', '> Pushing to octocat/Hello-World@Hello-World/test-branch...', '[command]git push origin Hello-World/test-branch:refs/heads/Hello-World/test-branch', @@ -881,6 +881,7 @@ describe('execute', () => { '::group::Target PullRequest Ref [change/new-topic1]', '> Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'', ' >> stdout', '[command]git reset --hard', @@ -898,6 +899,7 @@ describe('execute', () => { ' >> stdout', '> Merging [origin/master] branch...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'', ' >> stdout', '[command]git config \'user.name\' test-actor', @@ -913,7 +915,8 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + ' >> stdout', '[command]git diff \'HEAD..origin/master\' --name-only', '::endgroup::', '::group::Target PullRequest Ref [change/new-topic2]', @@ -965,6 +968,7 @@ describe('execute', () => { '::group::Target PullRequest Ref [change/new-topic1]', '> Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'', ' >> stdout', '[command]git reset --hard', @@ -982,6 +986,7 @@ describe('execute', () => { ' >> stdout', '> Merging [origin/master] branch...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'', ' >> stdout', '[command]git config \'user.name\' test-actor', @@ -997,7 +1002,8 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + ' >> stdout', '[command]git diff \'HEAD..origin/master\' --name-only', '::endgroup::', '::group::Target PullRequest Ref [change/new-topic2]', @@ -1352,7 +1358,7 @@ describe('execute', () => { '> There is no diff.', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::endgroup::', '::group::Merging [origin/feature/new-feature] branch...', @@ -1547,6 +1553,7 @@ describe('execute', () => { stdoutCalledWith(mockStdout, [ '::group::Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/Hello-World/test-21031067:refs/remotes/origin/Hello-World/test-21031067\'', ' >> stdout', '[command]git reset --hard', @@ -1564,6 +1571,7 @@ describe('execute', () => { '::endgroup::', '::group::Cloning [feature/new-feature] from the remote repo...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\'', ' >> stdout', '[command]git checkout -b feature/new-feature origin/feature/new-feature', @@ -1586,7 +1594,8 @@ describe('execute', () => { '> There is no diff.', '::endgroup::', '::group::Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature', + ' >> stdout', '[command]git diff \'HEAD..origin/feature/new-feature\' --name-only', '::endgroup::', '::group::Creating PullRequest...', @@ -1658,6 +1667,7 @@ describe('execute', () => { '::group::Target PullRequest Ref [change/new-topic1]', '> Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'', ' >> stdout', '[command]git reset --hard', @@ -1675,6 +1685,7 @@ describe('execute', () => { ' >> stdout', '> Merging [origin/master] branch...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'', ' >> stdout', '[command]git config \'user.name\' test-actor', @@ -1690,7 +1701,8 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + ' >> stdout', '[command]git diff \'HEAD..origin/master\' --name-only', '> Checking auto merge...', '> All checks are passed.', @@ -1759,6 +1771,7 @@ describe('execute', () => { '::group::Target PullRequest Ref [change/new-topic1]', '> Fetching...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'', ' >> stdout', '[command]git reset --hard', @@ -1776,6 +1789,7 @@ describe('execute', () => { ' >> stdout', '> Merging [origin/master] branch...', '[command]git remote add origin', + ' >> stdout', '[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'', ' >> stdout', '[command]git config \'user.name\' test-actor', @@ -1791,7 +1805,8 @@ describe('execute', () => { '[command]git status --short -uno', '> There is no diff.', '> Checking references diff...', - '[command]git fetch --prune --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + '[command]git fetch --prune --no-tags --no-recurse-submodules origin +refs/heads/master:refs/remotes/origin/master', + ' >> stdout', '[command]git diff \'HEAD..origin/master\' --name-only', '> Checking auto merge...', '> Number of days since creation is not more than threshold.', diff --git a/package.json b/package.json index b4c1041..5f63be6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@technote-space/github-action-pr-helper", - "version": "2.0.3", + "version": "2.0.4", "description": "PullRequest Helper for GitHub Actions.", "keywords": [ "github", @@ -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.2", + "@technote-space/github-action-helper": "^4.4.1", "moment": "^2.29.1" }, "devDependencies": { diff --git a/src/utils/command.ts b/src/utils/command.ts index 3b312ac..a545e6a 100644 --- a/src/utils/command.ts +++ b/src/utils/command.ts @@ -7,7 +7,6 @@ import {PullsListResponseData} from '@octokit/types'; import { getActionDetail, isDisabledDeletePackage, - filterExtension, getPrHeadRef, getContextBranch, getGitFilterStatus, @@ -154,7 +153,7 @@ export const getRefDiff = async(compare: string, helper: GitHelper, logger: Logg logger.startProcess('Checking references diff...'); await helper.fetchBranch(getWorkspace(), compare, context.actionContext); - return (await helper.getRefDiff(getWorkspace(), 'HEAD', compare, getGitFilterStatus(context), '..')).filter(line => filterExtension(line, context)); + return (await helper.getRefDiff(getWorkspace(), 'HEAD', compare, getGitFilterStatus(context), '..')); }; const initDirectory = async(helper: GitHelper, logger: Logger): Promise => { diff --git a/yarn.lock b/yarn.lock index 9bd9980..1cdb0c5 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.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== +"@technote-space/github-action-helper@^4.4.1": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@technote-space/github-action-helper/-/github-action-helper-4.4.1.tgz#ea8105c9edb0cab1c9af1f716bdc7e59c932f53b" + integrity sha512-ob4dlZqPU1o+VMC3WU3UXwC9Cm189NVM9jkWk5XeNEMLp8NS+SlNUdYhdAla6VcaEMUgJS6NXL76977ClvmFoQ== dependencies: "@actions/core" "^1.2.6" "@actions/github" "^4.0.0"