mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-07-31 15:26:10 +08:00
Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
394681d465 | ||
|
a261484cc8 | ||
|
43ed630979 | ||
|
ee9d717e46 | ||
|
68b94ecdf3 | ||
|
2b0a9bca02 | ||
|
13c9c82cae | ||
|
6e0a745133 | ||
|
88ddd5fba5 | ||
|
2dec151b5c | ||
|
1ba0b8765f | ||
|
f278d451d8 | ||
|
1f6bf5e4c0 | ||
|
5dae7dbdb7 | ||
|
fbbf9665a8 | ||
|
e8ab63a01b | ||
|
fdbf836519 | ||
|
8f94f9b7ec | ||
|
e6db1ef8bd | ||
|
d09082150e | ||
|
3e578b5696 | ||
|
c586963a3d | ||
|
a7342eab13 | ||
|
256f31683d | ||
|
8040ba33d6 | ||
|
80c7ed953f | ||
|
dd055f6225 | ||
|
55734408b7 | ||
|
d317154f77 | ||
|
36489f4cb5 | ||
|
2530046e72 | ||
|
172c2a2fc3 | ||
|
480e111bf8 | ||
|
7659782c71 | ||
|
026f88c27c | ||
|
f73d11d461 | ||
|
2b6b90e8f1 | ||
|
e1770ec52b | ||
|
0453bb1c25 | ||
|
da55e4a0cf | ||
|
b1833bd054 | ||
|
6dfda22dd6 |
2
.github/workflows/continuous-deployment.yml
vendored
2
.github/workflows/continuous-deployment.yml
vendored
@@ -25,5 +25,7 @@ jobs:
|
||||
with:
|
||||
draft: false
|
||||
prerelease: false
|
||||
body: |
|
||||
See [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) for details.
|
||||
release_name: "${{ steps.determine-tag.outputs.tag }}"
|
||||
tag_name: "${{ steps.determine-tag.outputs.tag }}"
|
||||
|
34
CHANGELOG.md
34
CHANGELOG.md
@@ -4,10 +4,42 @@ 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.0...HEAD)
|
||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.5...HEAD)
|
||||
|
||||
> TBD
|
||||
|
||||
## [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
|
||||
- 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
|
||||
|
||||
### Fixes
|
||||
- Fix Issue with `changes_detected`-output [#57](https://github.com/stefanzweifel/git-auto-commit-action/pull/57)
|
||||
|
||||
## [v4.1.1](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.0...v4.1.1) - 2020-03-14
|
||||
|
||||
### Fixes
|
||||
- Fix issue where commit has not been pushed to remote repository, when no `branch`-option has been given [#54](https://github.com/stefanzweifel/git-auto-commit-action/pull/54)
|
||||
|
||||
|
||||
## [v4.1.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.0.0...v4.1.0) - 2020-03-05
|
||||
|
||||
|
16
README.md
16
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.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.5
|
||||
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: .
|
||||
@@ -37,7 +37,7 @@ Add the following step at the end of your job.
|
||||
# Optional commit user and author settings
|
||||
commit_user_name: My GitHub Actions Bot
|
||||
commit_user_email: my-github-actions-bot@example.org
|
||||
commit_author: Author <actions@gitub.com>
|
||||
commit_author: Author <actions@github.com>
|
||||
|
||||
# Optional tag message. Will create and push a new tag to the remote repository
|
||||
tagging_message: 'v1.0.0'
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.5
|
||||
with:
|
||||
commit_message: Apply php-cs-fixer changes
|
||||
branch: ${{ github.head_ref }}
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.5
|
||||
with:
|
||||
commit_message: Apply php-cs-fixer changes
|
||||
```
|
||||
@@ -117,14 +117,14 @@ You can use these outputs to trigger other Actions in your Workflow run based on
|
||||
If your Workflow can't push the commit to the repository because of authentication issues, please update your Workflow configuration and usage of [`actions/checkout`](https://github.com/actions/checkout#usage). (Updating the `token` value with a Personal Access Token should fix your issues)
|
||||
|
||||
### Commit of this Action does not trigger a new Workflow run
|
||||
As mentioned in the [Usage](#Usage) section, the commit created by this Action **will not trigger** a new Workflow run automatically.
|
||||
As mentioned in the [Usage](#Usage) section, the commit created by this Action **will not trigger** a new Workflow run automatically.
|
||||
|
||||
This is due to limitations set up by GitHub:
|
||||
|
||||
> An action in a workflow run can't trigger a new workflow run. For example, if an action pushes code using the repository's GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.
|
||||
[Source](https://help.github.com/en/actions/reference/events-that-trigger-workflows)
|
||||
|
||||
You can change this by creating a new [Pesonal Access Token (PAT)](https://github.com/settings/tokens/new), storing the token as a secret in your repository and then passing the new token to the [`actions/checkout`](https://github.com/actions/checkout#usage) Action.
|
||||
You can change this by creating a new [Personal Access Token (PAT)](https://github.com/settings/tokens/new), storing the token as a secret in your repository and then passing the new token to the [`actions/checkout`](https://github.com/actions/checkout#usage) Action.
|
||||
|
||||
#### Example Workflow
|
||||
|
||||
@@ -145,7 +145,7 @@ jobs:
|
||||
- name: Run php-cs-fixer
|
||||
uses: docker://oskarstark/php-cs-fixer-ga
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4.1.5
|
||||
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,9 +7,7 @@ _main() {
|
||||
|
||||
if _git_is_dirty; then
|
||||
|
||||
echo \"::set-output name=changes_detected::true\"
|
||||
|
||||
_setup_git
|
||||
echo "::set-output name=changes_detected::true";
|
||||
|
||||
_switch_to_branch
|
||||
|
||||
@@ -22,43 +20,44 @@ _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() {
|
||||
[ -n "$(git status -s)" ]
|
||||
}
|
||||
|
||||
# Set up git user configuration
|
||||
_setup_git ( ) {
|
||||
git config --global user.name "$INPUT_COMMIT_USER_NAME"
|
||||
git config --global user.email "$INPUT_COMMIT_USER_EMAIL"
|
||||
}
|
||||
|
||||
_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 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() {
|
||||
@@ -66,16 +65,29 @@ _tag_commit() {
|
||||
|
||||
if [ -n "$INPUT_TAGGING_MESSAGE" ]
|
||||
then
|
||||
git tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE"
|
||||
echo "::debug::Create tag $INPUT_TAGGING_MESSAGE";
|
||||
git tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE";
|
||||
else
|
||||
echo " No tagging message supplied. No tag will be added.";
|
||||
fi
|
||||
}
|
||||
|
||||
_push_to_github() {
|
||||
if [ -z "$INPUT_BRANCH" ]
|
||||
then
|
||||
git push origin --tags
|
||||
# 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;
|
||||
else
|
||||
echo "::debug::git push origin";
|
||||
git push origin;
|
||||
fi
|
||||
|
||||
else
|
||||
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