Skip to content

Commit e7955f7

Browse files
committed
Emit warning if deprecated/removed options are used
1 parent 739fd03 commit e7955f7

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ _log() {
2727
}
2828

2929
_main() {
30+
if "$INPUT_SKIP_FETCH"; then
31+
_log "warning" "skip_fetch has been removed in v6. It does not have any effect anymore.";
32+
fi
33+
34+
if "$INPUT_SKIP_CHECKOUT"; then
35+
_log "warning" "skip_checkout has been removed in v6. It does not have any effect anymore.";
36+
fi
37+
38+
if "$INPUT_CREATE_BRANCH"; then
39+
_log "warning" "create_branch has been removed in v6. It does not have any effect anymore.";
40+
fi
41+
3042
_check_if_git_is_available
3143

3244
_switch_to_repository

tests/git-auto-commit.bats

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ setup() {
3838
export INPUT_DISABLE_GLOBBING=false
3939
export INPUT_INTERNAL_GIT_BINARY=git
4040

41+
# Deprecated variables. Will be removed in future versions
42+
export INPUT_CREATE_BRANCH=false
43+
export INPUT_SKIP_FETCH=false
44+
export INPUT_SKIP_CHECKOUT=false
45+
4146
# Set GitHub environment variables used by the GitHub Action
4247
temp_github_output_file=$(mktemp -t github_output_test.XXXXX)
4348
export GITHUB_OUTPUT="${temp_github_output_file}"
@@ -1161,3 +1166,17 @@ END
11611166
run git tag
11621167
assert_output ""
11631168
}
1169+
1170+
@test "it shows warning message if any deprecated options are used" {
1171+
INPUT_SKIP_FETCH=true
1172+
INPUT_SKIP_CHECKOUT=true
1173+
INPUT_CREATE_BRANCH=true
1174+
1175+
run git_auto_commit
1176+
1177+
assert_success
1178+
1179+
assert_line "::warning::skip_fetch has been removed in v6. It does not have any effect anymore."
1180+
assert_line "::warning::skip_checkout has been removed in v6. It does not have any effect anymore."
1181+
assert_line "::warning::create_branch has been removed in v6. It does not have any effect anymore."
1182+
}

0 commit comments

Comments
 (0)