Merge pull request #197 from cmbuckley/skip-checkout
Some checks failed
Lint Code Base / Lint Code Base (push) Failing after 4s
Some checks failed
Lint Code Base / Lint Code Base (push) Failing after 4s
Add `skip_checkout` option
This commit is contained in:
commit
8040434425
@ -78,6 +78,9 @@ The following is an extended example with all possible options available for thi
|
|||||||
# Optional. Skip internal call to `git fetch`
|
# Optional. Skip internal call to `git fetch`
|
||||||
skip_fetch: true
|
skip_fetch: true
|
||||||
|
|
||||||
|
# Optional. Skip internal call to `git checkout`
|
||||||
|
skip_checkout: 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
|
||||||
|
@ -60,6 +60,10 @@ inputs:
|
|||||||
description: Skip the call to git-fetch.
|
description: Skip the call to git-fetch.
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
skip_checkout:
|
||||||
|
description: Skip the call to git-checkout.
|
||||||
|
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
|
||||||
|
@ -55,9 +55,13 @@ _switch_to_branch() {
|
|||||||
git fetch --depth=1;
|
git fetch --depth=1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if "$INPUT_SKIP_CHECKOUT"; then
|
||||||
|
echo "::debug::git-checkout has not been executed";
|
||||||
|
else
|
||||||
# Switch to branch from current Workflow run
|
# Switch to branch from current Workflow run
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
git checkout $INPUT_BRANCH;
|
git checkout $INPUT_BRANCH;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_files() {
|
_add_files() {
|
||||||
|
@ -24,6 +24,7 @@ setup() {
|
|||||||
export INPUT_PUSH_OPTIONS=""
|
export INPUT_PUSH_OPTIONS=""
|
||||||
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_DISABLE_GLOBBING=false
|
export INPUT_DISABLE_GLOBBING=false
|
||||||
|
|
||||||
# Configure Git
|
# Configure Git
|
||||||
@ -381,6 +382,19 @@ git_auto_commit() {
|
|||||||
assert_line "::debug::git-fetch has not been executed"
|
assert_line "::debug::git-fetch has not been executed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "If SKIP_CHECKOUT is true git-checkout will not be called" {
|
||||||
|
|
||||||
|
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
|
||||||
|
|
||||||
|
INPUT_SKIP_CHECKOUT=true
|
||||||
|
|
||||||
|
run git_auto_commit
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_line "::debug::git-checkout has not been executed"
|
||||||
|
}
|
||||||
|
|
||||||
@test "It pushes generated commit and tag to remote and actually updates the commit shas" {
|
@test "It pushes generated commit and tag to remote and actually updates the commit shas" {
|
||||||
INPUT_BRANCH=""
|
INPUT_BRANCH=""
|
||||||
INPUT_TAGGING_MESSAGE="v2.0.0"
|
INPUT_TAGGING_MESSAGE="v2.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user