Skip to content

Commit f91ff67

Browse files
Add skip_push input option (#401)
1 parent acad9d5 commit f91ff67

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/git-auto-commit.bats

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ setup() {
3838
export INPUT_SKIP_DIRTY_CHECK=false
3939
export INPUT_SKIP_FETCH=false
4040
export INPUT_SKIP_CHECKOUT=false
41+
export INPUT_SKIP_PUSH=false
4142
export INPUT_DISABLE_GLOBBING=false
4243
export INPUT_CREATE_BRANCH=false
4344
export INPUT_INTERNAL_GIT_BINARY=git
@@ -352,6 +353,24 @@ cat_github_output() {
352353
assert_equal $current_sha $remote_sha
353354
}
354355

356+
@test "If SKIP_PUSH is true git-push will not be called" {
357+
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
358+
359+
INPUT_SKIP_PUSH=true
360+
361+
run git_auto_commit
362+
363+
assert_success
364+
365+
assert_line "::debug::git-push will not be executed."
366+
367+
# Assert that the sha values are not equal on local and remote
368+
current_sha="$(git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH})"
369+
remote_sha="$(git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH})"
370+
371+
refute [assert_equal $current_sha $remote_sha]
372+
}
373+
355374
@test "It can checkout a different branch" {
356375
# Create foo-branch and then immediately switch back to ${FAKE_DEFAULT_BRANCH}
357376
git checkout -b foo
@@ -1501,4 +1520,4 @@ END
15011520
remote_sha="$(git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH})"
15021521

15031522
assert_equal $current_sha $remote_sha
1504-
}
1523+
}

0 commit comments

Comments
 (0)