File tree Expand file tree Collapse file tree 4 files changed +28
-3
lines changed
Expand file tree Collapse file tree 4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ The following is an extended example with all possible options available for thi
7878 # Optional. Skip internal call to `git fetch`
7979 skip_fetch : true
8080
81+ # Optional. Skip internal call to `git checkout`
82+ skip_checkout : true
83+
8184 # Optional. Prevents the shell from expanding filenames.
8285 # Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html
8386 disable_globbing : true
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ inputs:
6060 description : Skip the call to git-fetch.
6161 required : false
6262 default : false
63+ skip_checkout :
64+ description : Skip the call to git-checkout.
65+ required : false
66+ default : false
6367 disable_globbing :
6468 description : Stop the shell from expanding filenames (https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html)
6569 default : false
Original file line number Diff line number Diff line change @@ -55,9 +55,13 @@ _switch_to_branch() {
5555 git fetch --depth=1;
5656 fi
5757
58- # Switch to branch from current Workflow run
59- # shellcheck disable=SC2086
60- git checkout $INPUT_BRANCH ;
58+ if " $INPUT_SKIP_CHECKOUT " ; then
59+ echo " ::debug::git-checkout has not been executed" ;
60+ else
61+ # Switch to branch from current Workflow run
62+ # shellcheck disable=SC2086
63+ git checkout $INPUT_BRANCH ;
64+ fi
6165}
6266
6367_add_files () {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ setup() {
2424 export INPUT_PUSH_OPTIONS=" "
2525 export INPUT_SKIP_DIRTY_CHECK=false
2626 export INPUT_SKIP_FETCH=false
27+ export INPUT_SKIP_CHECKOUT=false
2728 export INPUT_DISABLE_GLOBBING=false
2829
2930 # Configure Git
@@ -381,6 +382,19 @@ git_auto_commit() {
381382 assert_line " ::debug::git-fetch has not been executed"
382383}
383384
385+ @test " If SKIP_CHECKOUT is true git-checkout will not be called" {
386+
387+ touch " ${FAKE_LOCAL_REPOSITORY} " /new-file-{1,2,3}.txt
388+
389+ INPUT_SKIP_CHECKOUT=true
390+
391+ run git_auto_commit
392+
393+ assert_success
394+
395+ assert_line " ::debug::git-checkout has not been executed"
396+ }
397+
384398@test " It pushes generated commit and tag to remote and actually updates the commit shas" {
385399 INPUT_BRANCH=" "
386400 INPUT_TAGGING_MESSAGE=" v2.0.0"
You can’t perform that action at this time.
0 commit comments