File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ The following is an extended example with all available options.
115115
116116 # Optional. Skip internal call to `git checkout`
117117 skip_checkout : true
118+
119+ # Optional. Skip internal call to `git push`
120+ skip_push : true
118121
119122 # Optional. Prevents the shell from expanding filenames.
120123 # Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html
Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ inputs:
6868 description : Skip the call to git-checkout.
6969 required : false
7070 default : false
71+ skip_push :
72+ description : Skip the call to git-push.
73+ required : false
74+ default : false
7175 disable_globbing :
7276 description : Stop the shell from expanding filenames (https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html)
7377 default : false
Original file line number Diff line number Diff line change @@ -191,6 +191,10 @@ _tag_commit() {
191191}
192192
193193_push_to_github() {
194+ if "$INPUT_SKIP_PUSH "; then
195+ _log "debug" "git-push will not be executed.";
196+ return
197+ fi
194198
195199 echo "INPUT_BRANCH value: $INPUT_BRANCH ";
196200
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments