mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2024-11-06 02:08:05 +00:00
Merge pull request #131 from stefanzweifel/git-fetch-depth
Set --depth on git-fetch and make call to git-fetch optional
This commit is contained in:
commit
5b85132a3c
@ -65,6 +65,9 @@ This is a more extended example with all possible options.
|
|||||||
|
|
||||||
# Optional: Disable dirty check and always try to create a commit and push
|
# Optional: Disable dirty check and always try to create a commit and push
|
||||||
skip_dirty_check: true
|
skip_dirty_check: true
|
||||||
|
|
||||||
|
# Optional: Skip internal call to `git fetch`
|
||||||
|
skip_fetch: true
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
@ -48,6 +48,10 @@ inputs:
|
|||||||
description: Skip the check if the git repository is dirty and always try to create a commit.
|
description: Skip the check if the git repository is dirty and always try to create a commit.
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
skip_fetch:
|
||||||
|
description: Skip the call to git-fetch.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
changes_detected:
|
changes_detected:
|
||||||
|
@ -41,7 +41,12 @@ _switch_to_branch() {
|
|||||||
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
||||||
|
|
||||||
# Fetch remote to make sure that repo can be switched to the right branch.
|
# Fetch remote to make sure that repo can be switched to the right branch.
|
||||||
git fetch;
|
|
||||||
|
if "$INPUT_SKIP_FETCH"; then
|
||||||
|
echo "::debug::git-fetch has not been executed";
|
||||||
|
else
|
||||||
|
git fetch --depth=1;
|
||||||
|
fi
|
||||||
|
|
||||||
# Switch to branch from current Workflow run
|
# Switch to branch from current Workflow run
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
@ -21,6 +21,7 @@ setup() {
|
|||||||
export INPUT_TAGGING_MESSAGE=""
|
export INPUT_TAGGING_MESSAGE=""
|
||||||
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
|
||||||
|
|
||||||
# Configure Git
|
# Configure Git
|
||||||
if [[ -z $(git config user.name) ]]; then
|
if [[ -z $(git config user.name) ]]; then
|
||||||
@ -297,3 +298,16 @@ git_auto_commit() {
|
|||||||
run git ls-remote --tags --refs
|
run git ls-remote --tags --refs
|
||||||
assert_output --partial refs/tags/v2.0.0
|
assert_output --partial refs/tags/v2.0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "If SKIP_FETCH is true git-fetch will not be called" {
|
||||||
|
|
||||||
|
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
|
||||||
|
|
||||||
|
INPUT_SKIP_FETCH=true
|
||||||
|
|
||||||
|
run git_auto_commit
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_line "::debug::git-fetch has not been executed"
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user