mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-07-30 22:46:13 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3ea6ae190b | ||
|
976f22029f | ||
|
ebb5756042 | ||
|
3dce995a13 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -5,10 +5,22 @@ 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/)
|
||||
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.3...HEAD)
|
||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.4...HEAD)
|
||||
|
||||
> TBD
|
||||
|
||||
## [v4.15.4](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.3...v4.15.4) - 2022-11-05
|
||||
|
||||
### Fixed
|
||||
|
||||
- Let Action fail if git binary can't be located ([#261](https://github.com/stefanzweifel/git-auto-commit-action/pull/261)) [@stefanzweifel](https://github.com/@stefanzweifel)
|
||||
|
||||
### Dependency Updates
|
||||
|
||||
- Bump github/super-linter from 3 to 4 ([#258](https://github.com/stefanzweifel/git-auto-commit-action/pull/258)) [@dependabot](https://github.com/@dependabot)
|
||||
- Bump bats from 1.7.0 to 1.8.2 ([#259](https://github.com/stefanzweifel/git-auto-commit-action/pull/259)) [@dependabot](https://github.com/@dependabot)
|
||||
- Bump actions/checkout from 2 to 3 ([#257](https://github.com/stefanzweifel/git-auto-commit-action/pull/257)) [@dependabot](https://github.com/@dependabot)
|
||||
|
||||
## [v4.15.3](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.15.2...v4.15.3) - 2022-10-26
|
||||
|
||||
### Changed
|
||||
|
@@ -53,7 +53,7 @@ The following is an extended example with all available options.
|
||||
|
||||
# Optional commit user and author settings
|
||||
commit_user_name: My GitHub Actions Bot # defaults to "github-actions[bot]"
|
||||
commit_user_email: my-github-actions-bot@example.org # defaults to "github-actions[bot]@users.noreply.github.com"
|
||||
commit_user_email: my-github-actions-bot@example.org # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: Author <actions@github.com> # defaults to author of the commit that triggered the run
|
||||
|
||||
# Optional. Tag name being created in the local repository and
|
||||
@@ -399,7 +399,7 @@ If you go the "force pushes" route, you have to enable force pushes to a protect
|
||||
|
||||
### No new workflows are triggered by the commit of this action
|
||||
|
||||
This is due to limitations set up by GitHub, [commits of this Action do not trigger new Workflow runs](#commits-of-this-action-do-not-trigger-new-workflow-runs).
|
||||
This is due to limitations set up by GitHub, [commits made by this Action do not trigger new Workflow runs](#commits-made-by-this-action-do-not-trigger-new-workflow-runs).
|
||||
|
||||
### Pathspec 'x' did not match any files
|
||||
|
||||
|
@@ -39,7 +39,7 @@ inputs:
|
||||
commit_user_email:
|
||||
description: Email address used for the commit user
|
||||
required: false
|
||||
default: github-actions[bot]@users.noreply.github.com
|
||||
default: 41898282+github-actions[bot]@users.noreply.github.com
|
||||
commit_author:
|
||||
description: Value used for the commit author. Defaults to the username of whoever triggered this workflow run.
|
||||
required: false
|
||||
|
@@ -25,11 +25,28 @@ _main() {
|
||||
|
||||
_add_files
|
||||
|
||||
_local_commit
|
||||
# Check dirty state of repo again using git-diff.
|
||||
# (git-diff detects beter if CRLF of files changes and does NOT
|
||||
# proceed, if only CRLF changes are detected. See #241 and #265
|
||||
# for more details.)
|
||||
if [ -n "$(git diff --staged)" ] || "$INPUT_SKIP_DIRTY_CHECK"; then
|
||||
_local_commit
|
||||
|
||||
_tag_commit
|
||||
_tag_commit
|
||||
|
||||
_push_to_github
|
||||
_push_to_github
|
||||
else
|
||||
|
||||
# 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.";
|
||||
fi
|
||||
else
|
||||
|
||||
# Check if $GITHUB_OUTPUT is available
|
||||
|
@@ -974,7 +974,7 @@ cat_github_output() {
|
||||
assert_line --partial "another-subdirectory/new-file-3.txt"
|
||||
}
|
||||
|
||||
@test "fails to detect crlf change in files and does not detect change or commit changes" {
|
||||
@test "detects if crlf in files change and does not create commit" {
|
||||
# Set autocrlf to true
|
||||
cd "${FAKE_LOCAL_REPOSITORY}"
|
||||
git config core.autocrlf true
|
||||
@@ -982,26 +982,65 @@ cat_github_output() {
|
||||
assert_line "true"
|
||||
|
||||
# Add more .txt files
|
||||
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-2.txt
|
||||
touch "${FAKE_LOCAL_REPOSITORY}"/new-file-3.txt
|
||||
echo -ne "crlf test1\r\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-2.txt
|
||||
echo -ne "crlf test1\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-3.txt
|
||||
|
||||
# Run git-auto-commit to add new files to repository
|
||||
run git_auto_commit
|
||||
|
||||
# Change control characters in files
|
||||
sed 's/^M$//' "${FAKE_LOCAL_REPOSITORY}"/new-file-2.txt
|
||||
sed 's/$/^M/' "${FAKE_LOCAL_REPOSITORY}"/new-file-3.txt
|
||||
echo -ne "crlf test1\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-2.txt
|
||||
echo -ne "crlf test1\r\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-3.txt
|
||||
|
||||
# Run git-auto-commit to commit the 2 changes files
|
||||
run git_auto_commit
|
||||
|
||||
assert_success
|
||||
|
||||
# Changes are not detected
|
||||
assert_line --partial "Working tree clean. Nothing to commit."
|
||||
refute_line --partial "2 files changed, 2 insertions(+), 2 deletions(-)"
|
||||
assert_line --partial "warning: in the working copy of 'new-file-2.txt', LF will be replaced by CRLF the next time Git touches it"
|
||||
|
||||
refute_line --partial "new-file-2.txt"
|
||||
refute_line --partial "new-file-3.txt"
|
||||
assert_line --partial "Working tree clean. Nothing to commit."
|
||||
assert_line --partial "new-file-2.txt"
|
||||
assert_line --partial "new-file-3.txt"
|
||||
|
||||
# Changes are not detected
|
||||
run cat_github_output
|
||||
assert_line "changes_detected=false"
|
||||
}
|
||||
|
||||
@test "detects if crlf in files change and creates commit if the actual content of the files change" {
|
||||
# Set autocrlf to true
|
||||
cd "${FAKE_LOCAL_REPOSITORY}"
|
||||
git config core.autocrlf true
|
||||
run git config --get-all core.autocrlf
|
||||
assert_line "true"
|
||||
|
||||
# Add more .txt files
|
||||
echo -ne "crlf test1\r\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-2.txt
|
||||
echo -ne "crlf test1\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-3.txt
|
||||
|
||||
# Run git-auto-commit to add new files to repository
|
||||
run git_auto_commit
|
||||
|
||||
# Change control characters in files
|
||||
echo -ne "crlf test2\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-2.txt
|
||||
echo -ne "crlf test2\r\n" > "${FAKE_LOCAL_REPOSITORY}"/new-file-3.txt
|
||||
|
||||
# Run git-auto-commit to commit the 2 changes files
|
||||
run git_auto_commit
|
||||
|
||||
assert_success
|
||||
|
||||
assert_line --partial "2 files changed, 2 insertions(+), 2 deletions(-)"
|
||||
assert_line --partial "warning: in the working copy of 'new-file-2.txt', LF will be replaced by CRLF the next time Git touches it"
|
||||
|
||||
assert_line --partial "new-file-2.txt"
|
||||
assert_line --partial "new-file-3.txt"
|
||||
|
||||
# Changes are detected
|
||||
run cat_github_output
|
||||
assert_line "changes_detected=true"
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user