mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-07-31 15:26:10 +08:00
Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2f5e73df85 | ||
|
cc16347545 | ||
|
1ee136f439 | ||
|
7fdc480651 | ||
|
394681d465 | ||
|
a261484cc8 | ||
|
43ed630979 | ||
|
ee9d717e46 | ||
|
68b94ecdf3 | ||
|
2b0a9bca02 | ||
|
13c9c82cae | ||
|
6e0a745133 | ||
|
88ddd5fba5 | ||
|
2dec151b5c | ||
|
1ba0b8765f | ||
|
f278d451d8 | ||
|
1f6bf5e4c0 | ||
|
5dae7dbdb7 | ||
|
fbbf9665a8 | ||
|
e8ab63a01b | ||
|
fdbf836519 | ||
|
8f94f9b7ec | ||
|
e6db1ef8bd | ||
|
d09082150e | ||
|
3e578b5696 | ||
|
c586963a3d |
28
CHANGELOG.md
28
CHANGELOG.md
@@ -4,11 +4,35 @@ 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.1.3...HEAD)
|
||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.6...HEAD)
|
||||
|
||||
> TBD
|
||||
|
||||
## [v4.1.6](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.5...v4.1.6) - 2020-04-28
|
||||
|
||||
### Fixes
|
||||
- Fix issue where tags could not be created correctly [#68](https://github.com/stefanzweifel/git-auto-commit-action/pull/68)
|
||||
|
||||
## [v4.1.5](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.4...v4.1.5) - 2020-04-23
|
||||
|
||||
### Added
|
||||
- Update `file_pattern` to support multiple file paths [#65](https://github.com/stefanzweifel/git-auto-commit-action/pull/65)
|
||||
|
||||
### Changes
|
||||
- Revert changes made in v4.1.4 [#63](https://github.com/stefanzweifel/git-auto-commit-action/pull/63)
|
||||
|
||||
### Fixes
|
||||
- Fix issue with `commit_options` [#64](https://github.com/stefanzweifel/git-auto-commit-action/pull/64)
|
||||
|
||||
## [v4.1.4](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.3...v4.1.4) - 2020-04-22
|
||||
|
||||
### Fixed
|
||||
- Fix bug introduced in previous version, where git user configuration has been placed inline [#62](https://github.com/stefanzweifel/git-auto-commit-action/pull/62)
|
||||
|
||||
|
||||
## [v4.1.3](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.2...v4.1.3) - 2020-04-18
|
||||
|
||||
### Changed
|
||||
### Changed
|
||||
- Place Git user configuration inline [#59](https://github.com/stefanzweifel/git-auto-commit-action/pull/59)
|
||||
|
||||
## [v4.1.2](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.1...v4.1.2) - 2020-04-03
|
||||
|
12
README.md
12
README.md
@@ -17,7 +17,7 @@ This Action has been inspired and adapted from the [auto-commit](https://github.
|
||||
Add the following step at the end of your job.
|
||||
|
||||
```yaml
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.2
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.6
|
||||
with:
|
||||
commit_message: Apply automatic changes
|
||||
|
||||
@@ -29,7 +29,7 @@ Add the following step at the end of your job.
|
||||
commit_options: '--no-verify --signoff'
|
||||
|
||||
# Optional glob pattern of files which should be added to the commit
|
||||
file_pattern: src/\*.js
|
||||
file_pattern: src/*.js tests/*.js
|
||||
|
||||
# Optional local file path to the repository
|
||||
repository: .
|
||||
@@ -57,6 +57,8 @@ In this example I'm running `php-cs-fixer` in a PHP project.
|
||||
|
||||
### Example on `pull_request` event
|
||||
|
||||
If you would like to use this Action in a Workflow which listens to the `pull_request` event, you must add the `ref`-input to the `actions/checkout@v2` step. It's also recommended to add the `branch`-input to the `git-auto-commit`-step. This way you tell the Action exactly where to push the commit.
|
||||
|
||||
```yaml
|
||||
name: php-cs-fixer
|
||||
|
||||
@@ -74,7 +76,7 @@ jobs:
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.2
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.6
|
||||
with:
|
||||
commit_message: Apply php-cs-fixer changes
|
||||
branch: ${{ github.head_ref }}
|
||||
@@ -97,7 +99,7 @@ jobs:
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.2
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.6
|
||||
with:
|
||||
commit_message: Apply php-cs-fixer changes
|
||||
```
|
||||
@@ -145,7 +147,7 @@ jobs:
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.2
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.6
|
||||
with:
|
||||
commit_message: Apply php-cs-fixer changes
|
||||
```
|
||||
|
@@ -14,6 +14,7 @@ inputs:
|
||||
commit_options:
|
||||
description: Commit options (eg. --no-verify)
|
||||
required: false
|
||||
default: ''
|
||||
file_pattern:
|
||||
description: File pattern used for `git add`. For example `src/\*.js`
|
||||
required: false
|
||||
|
@@ -7,7 +7,7 @@ _main() {
|
||||
|
||||
if _git_is_dirty; then
|
||||
|
||||
echo "::set-output name=changes_detected::true"
|
||||
echo "::set-output name=changes_detected::true";
|
||||
|
||||
_switch_to_branch
|
||||
|
||||
@@ -20,16 +20,16 @@ _main() {
|
||||
_push_to_github
|
||||
else
|
||||
|
||||
echo "::set-output name=changes_detected::false"
|
||||
echo "::set-output name=changes_detected::false";
|
||||
|
||||
echo "Working tree clean. Nothing to commit."
|
||||
echo "Working tree clean. Nothing to commit.";
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
_switch_to_repository() {
|
||||
echo "INPUT_REPOSITORY value: $INPUT_REPOSITORY";
|
||||
cd $INPUT_REPOSITORY
|
||||
cd $INPUT_REPOSITORY;
|
||||
}
|
||||
|
||||
_git_is_dirty() {
|
||||
@@ -40,17 +40,24 @@ _switch_to_branch() {
|
||||
echo "INPUT_BRANCH value: $INPUT_BRANCH";
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
git checkout $INPUT_BRANCH
|
||||
git checkout $INPUT_BRANCH;
|
||||
}
|
||||
|
||||
_add_files() {
|
||||
echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}"
|
||||
git add "${INPUT_FILE_PATTERN}"
|
||||
echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}";
|
||||
git add ${INPUT_FILE_PATTERN};
|
||||
}
|
||||
|
||||
_local_commit() {
|
||||
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}"
|
||||
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"}
|
||||
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}";
|
||||
echo "::debug::Apply commit options ${INPUT_COMMIT_OPTIONS}";
|
||||
|
||||
INPUT_COMMIT_OPTIONS_ARRAY=( $INPUT_COMMIT_OPTIONS );
|
||||
|
||||
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" \
|
||||
commit -m "$INPUT_COMMIT_MESSAGE" \
|
||||
--author="$INPUT_COMMIT_AUTHOR" \
|
||||
${INPUT_COMMIT_OPTIONS:+"${INPUT_COMMIT_OPTIONS_ARRAY[@]}"};
|
||||
}
|
||||
|
||||
_tag_commit() {
|
||||
@@ -58,10 +65,10 @@ _tag_commit() {
|
||||
|
||||
if [ -n "$INPUT_TAGGING_MESSAGE" ]
|
||||
then
|
||||
echo "::debug::Create tag $INPUT_TAGGING_MESSAGE"
|
||||
git tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE"
|
||||
echo "::debug::Create tag $INPUT_TAGGING_MESSAGE";
|
||||
git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE";
|
||||
else
|
||||
echo " No tagging message supplied. No tag will be added."
|
||||
echo " No tagging message supplied. No tag will be added.";
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -71,16 +78,16 @@ _push_to_github() {
|
||||
# Only add `--tags` option, if `$INPUT_TAGGING_MESSAGE` is set
|
||||
if [ -n "$INPUT_TAGGING_MESSAGE" ]
|
||||
then
|
||||
echo "::debug::git push origin --tags"
|
||||
git push origin --tags
|
||||
echo "::debug::git push origin --tags";
|
||||
git push origin --tags;
|
||||
else
|
||||
echo "::debug::git push origin"
|
||||
git push origin
|
||||
echo "::debug::git push origin";
|
||||
git push origin;
|
||||
fi
|
||||
|
||||
else
|
||||
echo "::debug::Push commit to remote branch $INPUT_BRANCH"
|
||||
git push --set-upstream origin "HEAD:$INPUT_BRANCH" --tags
|
||||
echo "::debug::Push commit to remote branch $INPUT_BRANCH";
|
||||
git push --set-upstream origin "HEAD:$INPUT_BRANCH" --tags;
|
||||
fi
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user