mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2026-01-11 12:08:25 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0049e3fa40 | ||
|
|
f6f7a9c351 |
@@ -5,10 +5,16 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.1...HEAD)
|
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.2...HEAD)
|
||||||
|
|
||||||
> TBD
|
> TBD
|
||||||
|
|
||||||
|
## [v4.15.2](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.1...v4.15.2) - 2022-10-22
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Replace set-output usage with GITHUB_OUTPUT ([#252](https://github.com/stefanzweifel/git-auto-commit-action/pull/252)) [@amonshiz](https://github.com/amonshiz)
|
||||||
|
|
||||||
## [v4.15.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.0...v4.15.1) - 2022-10-10
|
## [v4.15.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.0...v4.15.1) - 2022-10-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -11,7 +11,13 @@ _main() {
|
|||||||
|
|
||||||
if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then
|
if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then
|
||||||
|
|
||||||
echo "changes_detected=true" >> $GITHUB_OUTPUT;
|
# Check if $GITHUB_OUTPUT is available
|
||||||
|
# (Feature detection will be removed in late December 2022)
|
||||||
|
if [ -z ${GITHUB_OUTPUT+x} ]; then
|
||||||
|
echo "::set-output name=changes_detected::true";
|
||||||
|
else
|
||||||
|
echo "changes_detected=true" >> $GITHUB_OUTPUT;
|
||||||
|
fi
|
||||||
|
|
||||||
_switch_to_branch
|
_switch_to_branch
|
||||||
|
|
||||||
@@ -24,7 +30,13 @@ _main() {
|
|||||||
_push_to_github
|
_push_to_github
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "changes_detected=false" >> $GITHUB_OUTPUT;
|
# Check if $GITHUB_OUTPUT is available
|
||||||
|
# (Feature detection will be removed in late December 2022)
|
||||||
|
if [ -z ${GITHUB_OUTPUT+x} ]; then
|
||||||
|
echo "::set-output name=changes_detected::false";
|
||||||
|
else
|
||||||
|
echo "changes_detected=false" >> $GITHUB_OUTPUT;
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Working tree clean. Nothing to commit.";
|
echo "Working tree clean. Nothing to commit.";
|
||||||
fi
|
fi
|
||||||
@@ -101,7 +113,14 @@ _local_commit() {
|
|||||||
--author="$INPUT_COMMIT_AUTHOR" \
|
--author="$INPUT_COMMIT_AUTHOR" \
|
||||||
${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"};
|
${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"};
|
||||||
|
|
||||||
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT;
|
|
||||||
|
# Check if $GITHUB_OUTPUT is available
|
||||||
|
# (Feature detection will be removed in late December 2022)
|
||||||
|
if [ -z ${GITHUB_OUTPUT+x} ]; then
|
||||||
|
echo "::set-output name=commit_hash::$(git rev-parse HEAD)";
|
||||||
|
else
|
||||||
|
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_tag_commit() {
|
_tag_commit() {
|
||||||
|
|||||||
@@ -57,7 +57,12 @@ teardown() {
|
|||||||
rm -rf "${FAKE_LOCAL_REPOSITORY}"
|
rm -rf "${FAKE_LOCAL_REPOSITORY}"
|
||||||
rm -rf "${FAKE_REMOTE}"
|
rm -rf "${FAKE_REMOTE}"
|
||||||
rm -rf "${FAKE_TEMP_LOCAL_REPOSITORY}"
|
rm -rf "${FAKE_TEMP_LOCAL_REPOSITORY}"
|
||||||
rm "${GITHUB_OUTPUT}"
|
|
||||||
|
if [ -z ${GITHUB_OUTPUT+x} ]; then
|
||||||
|
echo "GITHUB_OUTPUT is not set"
|
||||||
|
else
|
||||||
|
rm "${GITHUB_OUTPUT}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a fake remote repository which tests can push against
|
# Create a fake remote repository which tests can push against
|
||||||
@@ -997,3 +1002,42 @@ cat_github_output() {
|
|||||||
refute_line --partial "new-file-2.txt"
|
refute_line --partial "new-file-2.txt"
|
||||||
refute_line --partial "new-file-3.txt"
|
refute_line --partial "new-file-3.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@test "It uses old set-output syntax if GITHUB_OUTPUT environment is not available when changes are committed" {
|
||||||
|
unset GITHUB_OUTPUT
|
||||||
|
|
||||||
|
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-{1,2,3}.txt
|
||||||
|
|
||||||
|
run git_auto_commit
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
|
||||||
|
assert_line "INPUT_BRANCH value: ${FAKE_DEFAULT_BRANCH}"
|
||||||
|
assert_line "INPUT_FILE_PATTERN: ."
|
||||||
|
assert_line "INPUT_COMMIT_OPTIONS: "
|
||||||
|
assert_line "::debug::Apply commit options "
|
||||||
|
assert_line "INPUT_TAGGING_MESSAGE: "
|
||||||
|
assert_line "No tagging message supplied. No tag will be added."
|
||||||
|
assert_line "INPUT_PUSH_OPTIONS: "
|
||||||
|
assert_line "::debug::Apply push options "
|
||||||
|
assert_line "::debug::Push commit to remote branch ${FAKE_DEFAULT_BRANCH}"
|
||||||
|
|
||||||
|
assert_line "::set-output name=changes_detected::true"
|
||||||
|
assert_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "It uses old set-output syntax if GITHUB_OUTPUT environment is not available when no changes have been detected" {
|
||||||
|
unset GITHUB_OUTPUT
|
||||||
|
|
||||||
|
run git_auto_commit
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_line "INPUT_REPOSITORY value: ${INPUT_REPOSITORY}"
|
||||||
|
assert_line "Working tree clean. Nothing to commit."
|
||||||
|
|
||||||
|
assert_line "::set-output name=changes_detected::false"
|
||||||
|
refute_line -e "::set-output name=commit_hash::[0-9a-f]{40}$"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user