File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -151,15 +151,17 @@ update_doc() {
151151 exit $success
152152 fi
153153
154- if [ " ${INPUT_OUTPUT_METHOD} " == " inject" ] || [ " ${INPUT_OUTPUT_METHOD} " == " replace" ]; then
154+ if { [ " ${INPUT_OUTPUT_METHOD} " = " inject" ] || [ " ${INPUT_OUTPUT_METHOD} " = " replace" ] ; } && [ " ${INPUT_GIT_PUSH} " = " true " ]; then
155155 git_add " ${working_dir} /${OUTPUT_FILE} "
156156 fi
157157}
158158
159159# go to github repo
160160cd " ${GITHUB_WORKSPACE} "
161161
162- git_setup
162+ if [ " ${INPUT_GIT_PUSH} " = " true" ] || [ " ${INPUT_FAIL_ON_DIFF} " = " true" ]; then
163+ git_setup
164+ fi
163165
164166if [ -f " ${GITHUB_WORKSPACE} /${INPUT_ATLANTIS_FILE} " ]; then
165167 # Parse an atlantis yaml file
@@ -178,11 +180,13 @@ else
178180 done
179181fi
180182
181- # always set num_changed output
182- set +e
183- num_changed=$( git_status)
184- set -e
185- echo " num_changed=${num_changed} " >> " $GITHUB_OUTPUT "
183+ if [ " ${INPUT_GIT_PUSH} " = " true" ] || [ " ${INPUT_FAIL_ON_DIFF} " = " true" ]; then
184+ # set num_changed output only if git is enabled
185+ set +e
186+ num_changed=$( git_status)
187+ set -e
188+ echo " num_changed=${num_changed} " >> " $GITHUB_OUTPUT "
189+ fi
186190
187191if [ " ${INPUT_GIT_PUSH} " = " true" ]; then
188192 git_commit
You can’t perform that action at this time.
0 commit comments