mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2026-01-11 12:08:25 +00:00
Add skip_push input option (#401)
Co-authored-by: Stefan Zweifel <stefan@stefanzweifel.dev>
This commit is contained in:
@@ -116,6 +116,9 @@ The following is an extended example with all available options.
|
|||||||
# Optional. Skip internal call to `git checkout`
|
# Optional. Skip internal call to `git checkout`
|
||||||
skip_checkout: true
|
skip_checkout: true
|
||||||
|
|
||||||
|
# Optional. Skip internal call to `git push`
|
||||||
|
skip_push: true
|
||||||
|
|
||||||
# Optional. Prevents the shell from expanding filenames.
|
# Optional. Prevents the shell from expanding filenames.
|
||||||
# Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html
|
# Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html
|
||||||
disable_globbing: true
|
disable_globbing: true
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ inputs:
|
|||||||
description: Skip the call to git-checkout.
|
description: Skip the call to git-checkout.
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
skip_push:
|
||||||
|
description: Skip the call to git-push.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
disable_globbing:
|
disable_globbing:
|
||||||
description: Stop the shell from expanding filenames (https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html)
|
description: Stop the shell from expanding filenames (https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html)
|
||||||
default: false
|
default: false
|
||||||
|
|||||||
@@ -191,6 +191,10 @@ _tag_commit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_push_to_github() {
|
_push_to_github() {
|
||||||
|
if "$INPUT_SKIP_PUSH"; then
|
||||||
|
_log "debug" "git-push will not be executed.";
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ setup() {
|
|||||||
export INPUT_SKIP_DIRTY_CHECK=false
|
export INPUT_SKIP_DIRTY_CHECK=false
|
||||||
export INPUT_SKIP_FETCH=false
|
export INPUT_SKIP_FETCH=false
|
||||||
export INPUT_SKIP_CHECKOUT=false
|
export INPUT_SKIP_CHECKOUT=false
|
||||||
|
export INPUT_SKIP_PUSH=false
|
||||||
export INPUT_DISABLE_GLOBBING=false
|
export INPUT_DISABLE_GLOBBING=false
|
||||||
export INPUT_CREATE_BRANCH=false
|
export INPUT_CREATE_BRANCH=false
|
||||||
export INPUT_INTERNAL_GIT_BINARY=git
|
export INPUT_INTERNAL_GIT_BINARY=git
|
||||||
@@ -352,6 +353,24 @@ cat_github_output() {
|
|||||||
assert_equal $current_sha $remote_sha
|
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" {
|
@test "It can checkout a different branch" {
|
||||||
# Create foo-branch and then immediately switch back to ${FAKE_DEFAULT_BRANCH}
|
# Create foo-branch and then immediately switch back to ${FAKE_DEFAULT_BRANCH}
|
||||||
git checkout -b foo
|
git checkout -b foo
|
||||||
|
|||||||
Reference in New Issue
Block a user