mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2025-08-03 09:06:08 +08:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
90282bf5e2 | ||
|
c9eb2132b2 | ||
|
c8ded2885e | ||
|
f120678ed1 | ||
|
4183594932 | ||
|
49e28abb3f | ||
|
4ebfe28af0 | ||
|
984a26d893 | ||
|
3804c79d2e | ||
|
69a12041a1 | ||
|
91b7d20ead | ||
|
044b6b777c | ||
|
9aab2f8a5c | ||
|
0280d2ccee | ||
|
b0b5ed34dd | ||
|
ae38c94802 | ||
|
3aae7bb63f |
31
.github/workflows/continuous-deployment.yml
vendored
31
.github/workflows/continuous-deployment.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
|
|
||||||
|
|
||||||
name: "Continuous Deployment"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
name: "Release"
|
|
||||||
|
|
||||||
runs-on: "ubuntu-latest"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "Determine tag"
|
|
||||||
id: "determine-tag"
|
|
||||||
run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\""
|
|
||||||
|
|
||||||
- name: "Create release"
|
|
||||||
uses: "actions/create-release@v1.0.0"
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
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 }}"
|
|
15
.github/workflows/versioning.yml
vendored
Normal file
15
.github/workflows/versioning.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: Keep the versions up-to-date
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
actions-tagger:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: Actions-R-Us/actions-tagger@latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
|
||||||
|
with:
|
||||||
|
- publish_latest_tag: true
|
21
CHANGELOG.md
21
CHANGELOG.md
@@ -4,14 +4,29 @@ 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.2.0...HEAD)
|
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.4.0...HEAD)
|
||||||
|
|
||||||
> TBD
|
> TBD
|
||||||
|
|
||||||
|
|
||||||
|
## [v4.4.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.3.0...v4.4.0) - 2020-06-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add option to skipt the dirty check and always try to create and push a commit [#82](https://github.com/stefanzweifel/git-auto-commit-action/issues/82), [#84](https://github.com/stefanzweifel/git-auto-commit-action/pull/84)
|
||||||
|
|
||||||
|
|
||||||
|
## [v4.3.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.2.0...v4.3.0) - 2020-05-16
|
||||||
|
|
||||||
|
Note: Since v4.3.0 we provide major version tags. You can now use `stefanzweifel/git-auto-commit-action@v4` to always use the latest release of a major version. See [#77](https://github.com/stefanzweifel/git-auto-commit-action/issues/77) for details.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add new `push_options`-input. This feature makes it easier for you to force-push commits to a repository. [#78](https://github.com/stefanzweifel/git-auto-commit-action/pull/78), [#72](https://github.com/stefanzweifel/git-auto-commit-action/issues/72)
|
||||||
|
|
||||||
|
|
||||||
## [v4.2.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.6...v4.2.0) - 2020-05-10
|
## [v4.2.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4.1.6...v4.2.0) - 2020-05-10
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Use `${{ github.head_ref }}` as default branch value. Therefore, the branch name when listening for `pull_request`-events is optional. [#75](https://github.com/stefanzweifel/git-auto-commit-action/pull/75), [#73](https://github.com/stefanzweifel/git-auto-commit-action/pull/73)
|
- Use `${{ github.head_ref }}` as default branch value. Therefore, the branch name when listening for `pull_request`-events is optional. [#75](https://github.com/stefanzweifel/git-auto-commit-action/pull/75), [#73](https://github.com/stefanzweifel/git-auto-commit-action/pull/73)
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +85,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
### Added
|
### Added
|
||||||
- Add `commit_user_name`, `commit_user_email` and `commit_author` input options for full customzation on how the commit is being created [#39](https://github.com/stefanzweifel/git-auto-commit-action/pull/39)
|
- Add `commit_user_name`, `commit_user_email` and `commit_author` input options for full customzation on how the commit is being created [#39](https://github.com/stefanzweifel/git-auto-commit-action/pull/39)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Make the `branch` input option optional [#41](https://github.com/stefanzweifel/git-auto-commit-action/pull/41)
|
- Make the `branch` input option optional [#41](https://github.com/stefanzweifel/git-auto-commit-action/pull/41)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
28
README.md
28
README.md
@@ -13,7 +13,7 @@ This Action has been inspired and adapted from the [auto-commit](https://github.
|
|||||||
Add the following step at the end of your job, after other steps that might add or change files.
|
Add the following step at the end of your job, after other steps that might add or change files.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4.2.0
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
# Required
|
# Required
|
||||||
commit_message: Apply automatic changes
|
commit_message: Apply automatic changes
|
||||||
@@ -21,7 +21,7 @@ Add the following step at the end of your job, after other steps that might add
|
|||||||
# Optional branch to push to, defaults to the current branch
|
# Optional branch to push to, defaults to the current branch
|
||||||
branch: feature-123
|
branch: feature-123
|
||||||
|
|
||||||
# Optional git params
|
# Optional options appended to `git-commit`
|
||||||
commit_options: '--no-verify --signoff'
|
commit_options: '--no-verify --signoff'
|
||||||
|
|
||||||
# Optional glob pattern of files which should be added to the commit
|
# Optional glob pattern of files which should be added to the commit
|
||||||
@@ -38,6 +38,12 @@ Add the following step at the end of your job, after other steps that might add
|
|||||||
# Optional tag message
|
# Optional tag message
|
||||||
# Action will create and push a new tag to the remote repository and the defined branch
|
# Action will create and push a new tag to the remote repository and the defined branch
|
||||||
tagging_message: 'v1.0.0'
|
tagging_message: 'v1.0.0'
|
||||||
|
|
||||||
|
# Optional options appended to `git-push`
|
||||||
|
push_options: '--force'
|
||||||
|
|
||||||
|
# Optional: Disable dirty check and always try to create a commit and push
|
||||||
|
skip_dirty_check: true
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
@@ -68,7 +74,7 @@ jobs:
|
|||||||
- name: Run php-cs-fixer
|
- name: Run php-cs-fixer
|
||||||
uses: docker://oskarstark/php-cs-fixer-ga
|
uses: docker://oskarstark/php-cs-fixer-ga
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4.2.0
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
commit_message: Apply php-cs-fixer changes
|
commit_message: Apply php-cs-fixer changes
|
||||||
```
|
```
|
||||||
@@ -132,6 +138,19 @@ please update your Workflow configuration and usage of [`actions/checkout`](http
|
|||||||
|
|
||||||
Updating the `token` value with a Personal Access Token should fix your issues.
|
Updating the `token` value with a Personal Access Token should fix your issues.
|
||||||
|
|
||||||
|
## Action does not push to protected branch
|
||||||
|
|
||||||
|
If your repository uses [protected branches](https://help.github.com/en/github/administering-a-repository/configuring-protected-branches) this Action will not be able to push to your repository.
|
||||||
|
|
||||||
|
You have to enable force pushes to a protected branch (See [documentation](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)) and update your Workflow to use force push like so.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: Apply php-cs-fixer changes
|
||||||
|
push_options: --force
|
||||||
|
```
|
||||||
|
|
||||||
### No new workflows are triggered by the commit of this action
|
### 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 of this Action do not trigger new Workflow runs](#commits-of-this-action-do-not-trigger-new-workflow-runs).
|
||||||
@@ -140,6 +159,9 @@ This is due to limitations set up by GitHub, [commits of this Action do not trig
|
|||||||
|
|
||||||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/stefanzweifel/git-auto-commit-action/tags).
|
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/stefanzweifel/git-auto-commit-action/tags).
|
||||||
|
|
||||||
|
We also provide major version tags to make it easier to always use the latest release of a major version. For example you can use `stefanzweifel/git-auto-commit-action@v4` to always use the latest release of the current major version.
|
||||||
|
(More information about this [here](https://help.github.com/en/actions/building-actions/about-actions#versioning-your-action).)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the [LICENSE](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/LICENSE) file for details.
|
This project is licensed under the MIT License - see the [LICENSE](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/LICENSE) file for details.
|
||||||
|
@@ -39,6 +39,14 @@ inputs:
|
|||||||
description: Message used to create a new git tag with the commit. Keep this empty, if no tag should be created.
|
description: Message used to create a new git tag with the commit. Keep this empty, if no tag should be created.
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
push_options:
|
||||||
|
description: Push options (eg. --force)
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
skip_dirty_check:
|
||||||
|
description: Skip the check if the git repository is dirty and always try to create a commit.
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
changes_detected:
|
changes_detected:
|
||||||
|
@@ -5,7 +5,7 @@ set -eu
|
|||||||
_main() {
|
_main() {
|
||||||
_switch_to_repository
|
_switch_to_repository
|
||||||
|
|
||||||
if _git_is_dirty; then
|
if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then
|
||||||
|
|
||||||
echo "::set-output name=changes_detected::true";
|
echo "::set-output name=changes_detected::true";
|
||||||
|
|
||||||
@@ -73,21 +73,27 @@ _tag_commit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_push_to_github() {
|
_push_to_github() {
|
||||||
|
|
||||||
|
echo "INPUT_PUSH_OPTIONS: ${INPUT_PUSH_OPTIONS}";
|
||||||
|
echo "::debug::Apply push options ${INPUT_PUSH_OPTIONS}";
|
||||||
|
|
||||||
|
INPUT_PUSH_OPTIONS_ARRAY=( $INPUT_PUSH_OPTIONS );
|
||||||
|
|
||||||
if [ -z "$INPUT_BRANCH" ]
|
if [ -z "$INPUT_BRANCH" ]
|
||||||
then
|
then
|
||||||
# Only add `--tags` option, if `$INPUT_TAGGING_MESSAGE` is set
|
# Only add `--tags` option, if `$INPUT_TAGGING_MESSAGE` is set
|
||||||
if [ -n "$INPUT_TAGGING_MESSAGE" ]
|
if [ -n "$INPUT_TAGGING_MESSAGE" ]
|
||||||
then
|
then
|
||||||
echo "::debug::git push origin --tags";
|
echo "::debug::git push origin --tags";
|
||||||
git push origin --tags;
|
git push origin --tags ${INPUT_PUSH_OPTIONS:+"${INPUT_PUSH_OPTIONS_ARRAY[@]}"};
|
||||||
else
|
else
|
||||||
echo "::debug::git push origin";
|
echo "::debug::git push origin";
|
||||||
git push origin;
|
git push origin ${INPUT_PUSH_OPTIONS:+"${INPUT_PUSH_OPTIONS_ARRAY[@]}"};
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "::debug::Push commit to remote branch $INPUT_BRANCH";
|
echo "::debug::Push commit to remote branch $INPUT_BRANCH";
|
||||||
git push --set-upstream origin "HEAD:$INPUT_BRANCH" --tags;
|
git push --set-upstream origin "HEAD:$INPUT_BRANCH" --tags ${INPUT_PUSH_OPTIONS:+"${INPUT_PUSH_OPTIONS_ARRAY[@]}"};
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user