Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ describe('main', () => {
'::endgroup::',
'==================================================',
'',
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'::group::Total:0 Succeeded:0 Failed:0 Skipped:0',
'::set-output name=result::skipped',
'::endgroup::',
Expand Down
55 changes: 12 additions & 43 deletions __tests__/utils/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ describe('clone', () => {
}));

execCalledWith(mockExec, [
'git config --global \'init.defaultBranch\' master',
'git config \'user.name\' \'GitHub Actions\'',
'git config \'user.email\' \'example@example.com\'',
'git init \'.\'',
'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\' || :',
Expand All @@ -117,12 +114,6 @@ describe('clone', () => {
]);
stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'[command]git config \'user.name\' \'GitHub Actions\'',
' >> stdout',
'[command]git config \'user.email\' \'example@example.com\'',
' >> stdout',
'[command]git init \'.\'',
' >> stdout',
'[command]git remote add origin',
Expand Down Expand Up @@ -361,9 +352,6 @@ describe('getChangedFiles', () => {
});
stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'',
'[command]git reset --hard',
Expand All @@ -380,11 +368,10 @@ describe('getChangedFiles', () => {
'[command]ls -la',
'::endgroup::',
'::group::Merging [origin/hello-world/test-branch] branch...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git merge --no-edit origin/hello-world/test-branch',
' >> Auto-merging merge.txt',
' >> CONFLICT (content): Merge conflict in merge.txt',
Expand Down Expand Up @@ -441,9 +428,6 @@ describe('getChangedFiles', () => {
});
stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'',
'[command]git reset --hard',
Expand All @@ -458,11 +442,10 @@ describe('getChangedFiles', () => {
'[command]ls -la',
'::endgroup::',
'::group::Merging [origin/hello-world/test-branch] branch...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git merge --no-edit origin/hello-world/test-branch',
' >> Already up to date.',
'::endgroup::',
Expand Down Expand Up @@ -559,9 +542,6 @@ describe('getChangedFiles', () => {
});
stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'',
'[command]git reset --hard',
Expand All @@ -576,11 +556,10 @@ describe('getChangedFiles', () => {
'[command]ls -la',
'::endgroup::',
'::group::Merging [origin/hello-world/test-branch] branch...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/hello-world/test-branch:refs/remotes/origin/hello-world/test-branch\'',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git merge --no-edit origin/hello-world/test-branch',
' >> Already up to date.',
'::endgroup::',
Expand Down Expand Up @@ -834,12 +813,11 @@ describe('resolveConflicts', () => {
}));

execCalledWith(mockExec, [
'git config --global \'init.defaultBranch\' master',
'git config \'user.name\' \'GitHub Actions\'',
'git config \'user.email\' \'example@example.com\'',
'git init \'.\'',
'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\'',
]);
Expand Down Expand Up @@ -870,17 +848,13 @@ describe('resolveConflicts', () => {
}));

execCalledWith(mockExec, [
'git config --global \'init.defaultBranch\' master',
'git config \'user.name\' \'GitHub Actions\'',
'git config \'user.email\' \'example@example.com\'',
'git init \'.\'',
'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 merge --no-edit origin/feature/new-feature || :',
`rm -rdf ${workDir}`,
'git config --global \'init.defaultBranch\' master',
'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\' || :',
'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :',
Expand Down Expand Up @@ -928,17 +902,13 @@ describe('resolveConflicts', () => {
}));

execCalledWith(mockExec, [
'git config --global \'init.defaultBranch\' master',
'git config \'user.name\' \'GitHub Actions\'',
'git config \'user.email\' \'example@example.com\'',
'git init \'.\'',
'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 merge --no-edit origin/feature/new-feature || :',
`rm -rdf ${workDir}`,
'git config --global \'init.defaultBranch\' master',
'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\' || :',
'git fetch --no-tags origin \'refs/heads/feature/new-feature:refs/remotes/origin/feature/new-feature\' || :',
Expand All @@ -948,7 +918,6 @@ describe('resolveConflicts', () => {
'yarn upgrade',
'git add --all',
'git status --short -uno',
'git config --global \'init.defaultBranch\' master',
'git config \'user.name\' \'GitHub Actions\'',
'git config \'user.email\' \'example@example.com\'',
'git commit -qm \'commit message\'',
Expand Down
50 changes: 20 additions & 30 deletions __tests__/utils/process1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ describe('execute', () => {
}))).rejects.toThrow('There is a failed process.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' master',
'::group::Target PullRequest Ref [change/new-topic1]',
'> Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' test-actor',
'[command]git config \'user.email\' \'test-actor@users.noreply.github.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'',
'[command]git reset --hard',
Expand All @@ -129,11 +127,10 @@ describe('execute', () => {
'[command]git merge --no-edit origin/change/new-topic1',
'[command]ls -la',
'> Merging [origin/master] branch...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' test-actor',
'[command]git config \'user.email\' \'test-actor@users.noreply.github.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'',
'[command]git config \'user.name\' test-actor',
'[command]git config \'user.email\' \'test-actor@users.noreply.github.com\'',
'[command]git merge --no-edit origin/master',
'> Running commands...',
'> Checking diff...',
Expand Down Expand Up @@ -198,10 +195,8 @@ describe('execute', () => {
}));

stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'::group::Fetching...',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/Hello-World/test-21031067:refs/remotes/origin/Hello-World/test-21031067\'',
'[command]git reset --hard',
Expand All @@ -228,7 +223,6 @@ describe('execute', () => {
'::group::Checking diff...',
'[command]git add --all',
'[command]git status --short -uno',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'::endgroup::',
Expand Down Expand Up @@ -283,13 +277,9 @@ describe('execute', () => {
}));

stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'[command]git config \'user.name\' \'GitHub Actions\'',
' >> stdout',
'[command]git config \'user.email\' \'example@example.com\'',
' >> stdout',
'::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\'',
Expand Down Expand Up @@ -374,6 +364,8 @@ describe('execute', () => {
}, 'develop'))).rejects.toThrow('There is a failed process.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' develop',
' >> stdout',
'::group::Target PullRequest Ref [change/new-topic1]',
'> Closing PullRequest... [change/new-topic1]',
'> Deleting reference... [refs/heads/change/new-topic1]',
Expand Down Expand Up @@ -437,11 +429,9 @@ describe('execute', () => {
}))).rejects.toThrow('There is a failed process.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' master',
'::group::Target PullRequest Ref [change/new-topic1]',
'> Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/change/new-topic1:refs/remotes/origin/change/new-topic1\'',
'[command]git reset --hard',
Expand All @@ -453,17 +443,15 @@ describe('execute', () => {
'[command]git merge --no-edit origin/change/new-topic1',
'[command]ls -la',
'> Merging [origin/master] branch...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/master:refs/remotes/origin/master\'',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'[command]git merge --no-edit origin/master',
'> Running commands...',
'> Checking diff...',
'[command]git add --all',
'[command]git status --short -uno',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' \'GitHub Actions\'',
'[command]git config \'user.email\' \'example@example.com\'',
'> Committing...',
Expand Down Expand Up @@ -514,6 +502,8 @@ describe('execute', () => {
}, 'develop'))).rejects.toThrow('There is a failed process.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' develop',
' >> stdout',
'::group::Target PullRequest Ref [change/new-topic1]',
'> Closing PullRequest... [change/new-topic1]',
'> Deleting reference... [refs/heads/change/new-topic1]',
Expand Down Expand Up @@ -549,6 +539,8 @@ describe('execute', () => {
}))).rejects.toThrow('There are failed processes.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'::group::Target PullRequest Ref [change/new-topic1]',
'::endgroup::',
'::group::Target PullRequest Ref [change/new-topic2]',
Expand Down Expand Up @@ -578,6 +570,8 @@ describe('execute', () => {
}))).rejects.toThrow('There is a failed process.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'::group::Target PullRequest Ref [feature/new-topic3]',
'::endgroup::',
'::group::Target PullRequest Ref [feature/new-topic4]',
Expand Down Expand Up @@ -608,6 +602,8 @@ describe('execute', () => {
await expect(execute(octokit, getActionContext(context('', 'schedule'), {}))).rejects.toThrow('There is a failed process.');

stdoutCalledWith(mockStdout, [
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'::group::Target PullRequest Ref [master]',
'::endgroup::',
'::group::Total:3 Succeeded:0 Failed:1 Skipped:2',
Expand Down Expand Up @@ -646,13 +642,9 @@ describe('execute', () => {
}));

stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
' >> stdout',
'[command]git config \'user.name\' \'GitHub Actions\'',
' >> stdout',
'[command]git config \'user.email\' \'example@example.com\'',
' >> stdout',
'::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\'',
Expand Down Expand Up @@ -724,10 +716,8 @@ describe('execute', () => {
}));

stdoutCalledWith(mockStdout, [
'::group::Fetching...',
'[command]git config --global \'init.defaultBranch\' master',
'[command]git config \'user.name\' test-actor',
'[command]git config \'user.email\' \'test-actor@users.noreply.github.com\'',
'::group::Fetching...',
'[command]git remote add origin',
'[command]git fetch --no-tags origin \'refs/heads/test/change:refs/remotes/origin/test/change\'',
'[command]git reset --hard',
Expand Down
Loading