Add skip_push input option (#401)

Co-authored-by: Stefan Zweifel <stefan@stefanzweifel.dev>
This commit is contained in:
Koen van Zuijlen
2025-12-17 20:23:26 +01:00
committed by GitHub
parent 65c56779c9
commit 1e49d5001f
4 changed files with 30 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ setup() {
export INPUT_SKIP_DIRTY_CHECK=false
export INPUT_SKIP_FETCH=false
export INPUT_SKIP_CHECKOUT=false
export INPUT_SKIP_PUSH=false
export INPUT_DISABLE_GLOBBING=false
export INPUT_CREATE_BRANCH=false
export INPUT_INTERNAL_GIT_BINARY=git
@@ -352,6 +353,24 @@ cat_github_output() {
assert_equal $current_sha $remote_sha
}
@test "If SKIP_PUSH is true git-push will not be called" {
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
INPUT_SKIP_PUSH=true
run git_auto_commit
assert_success
assert_line "::debug::git-push will not be executed."
# Assert that the sha values are not equal on local and remote
current_sha="$(git rev-parse --verify --short ${FAKE_DEFAULT_BRANCH})"
remote_sha="$(git rev-parse --verify --short origin/${FAKE_DEFAULT_BRANCH})"
refute [assert_equal $current_sha $remote_sha]
}
@test "It can checkout a different branch" {
# Create foo-branch and then immediately switch back to ${FAKE_DEFAULT_BRANCH}
git checkout -b foo