From 94de44f232f15ebdef1a6c8190071faad8bfd5bc Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:31:53 +0100 Subject: [PATCH 1/3] feat: add skip_push input option --- action.yml | 4 ++++ entrypoint.sh | 4 ++++ tests/git-auto-commit.bats | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/action.yml b/action.yml index 6c1d098e..ed7e85fa 100644 --- a/action.yml +++ b/action.yml @@ -68,6 +68,10 @@ inputs: description: Skip the call to git-checkout. required: false default: false + skip_push: + description: Skip the call to git-push. + required: false + default: false disable_globbing: description: Stop the shell from expanding filenames (https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html) default: false diff --git a/entrypoint.sh b/entrypoint.sh index d288a67a..09fb6b73 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -191,6 +191,10 @@ _tag_commit() { } _push_to_github() { + if "$INPUT_SKIP_PUSH"; then + _log "debug" "git-push will not be executed."; + return + fi echo "INPUT_BRANCH value: $INPUT_BRANCH"; diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index a0fdc366..b9d004d3 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -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,25 @@ 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 commit has been pushed with --force and + # 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 From d6bd33613190ff390b67c88e6ec8d942a7fafc2d Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Mon, 15 Dec 2025 14:33:42 +0100 Subject: [PATCH 2/3] docs: update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1cdc4b00..e83039a9 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,8 @@ The following is an extended example with all available options. # Optional. Skip internal call to `git checkout` skip_checkout: true + + # Optional. Skip internal call to `git push` # Optional. Prevents the shell from expanding filenames. # Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html From b9c8ec486e12a28267360612047a88fa6d91f4a1 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 17 Dec 2025 20:21:48 +0100 Subject: [PATCH 3/3] Update Docs --- README.md | 1 + tests/git-auto-commit.bats | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e83039a9..07dbf82e 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ The following is an extended example with all available options. skip_checkout: true # Optional. Skip internal call to `git push` + skip_push: true # Optional. Prevents the shell from expanding filenames. # Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index b9d004d3..9e39f7ea 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -364,8 +364,7 @@ cat_github_output() { assert_line "::debug::git-push will not be executed." - # Assert that the commit has been pushed with --force and - # sha values are not equal on local and remote + # 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})"