mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2024-12-06 02:09:04 +00:00
Merge pull request #39 from stefanzweifel/feature/commiter-options
Add Options to change Commit User Name and Email and Author
This commit is contained in:
commit
098f1a8051
@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.5.0...HEAD)
|
## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.5.0...HEAD)
|
||||||
|
|
||||||
|
### 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)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Remove the need of a GITHUB_TOKEN. Users now have to use `actions/checkout@v2` or higher [#36](https://github.com/stefanzweifel/git-auto-commit-action/pull/36)
|
- Remove the need of a GITHUB_TOKEN. Users now have to use `actions/checkout@v2` or higher [#36](https://github.com/stefanzweifel/git-auto-commit-action/pull/36)
|
||||||
|
|
||||||
|
11
README.md
11
README.md
@ -1,7 +1,7 @@
|
|||||||
# git-auto-commit-action
|
# git-auto-commit-action
|
||||||
|
|
||||||
This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the Commit back to GitHub.
|
This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the commit back to GitHub.
|
||||||
The Committer is "GitHub Actions <actions@github.com>" and the Author of the Commit is "Your GitHub Username <github_username@users.noreply.github.com>.
|
The default committer is "GitHub Actions <actions@github.com>" and the default author of the commit is "Your GitHub Username <github_username@users.noreply.github.com>".
|
||||||
|
|
||||||
If no changes are detected, the Action does nothing.
|
If no changes are detected, the Action does nothing.
|
||||||
|
|
||||||
@ -28,8 +28,13 @@ Add the following step at the end of your job.
|
|||||||
# Optional glob pattern of files which should be added to the commit
|
# Optional glob pattern of files which should be added to the commit
|
||||||
file_pattern: src/\*.js
|
file_pattern: src/\*.js
|
||||||
|
|
||||||
# Optional repository path
|
# Optional local file path to the repository
|
||||||
repository: .
|
repository: .
|
||||||
|
|
||||||
|
# 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>
|
||||||
```
|
```
|
||||||
|
|
||||||
The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run!
|
The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run!
|
||||||
|
22
action.yml
22
action.yml
@ -7,20 +7,32 @@ inputs:
|
|||||||
commit_message:
|
commit_message:
|
||||||
description: Commit message
|
description: Commit message
|
||||||
required: true
|
required: true
|
||||||
|
branch:
|
||||||
|
description: Git branch name, where changes should be pushed too.
|
||||||
|
required: true
|
||||||
commit_options:
|
commit_options:
|
||||||
description: Commit options (eg. --no-verify)
|
description: Commit options (eg. --no-verify)
|
||||||
required: false
|
required: false
|
||||||
branch:
|
|
||||||
description: Branch name where changes should be pushed too
|
|
||||||
required: true
|
|
||||||
file_pattern:
|
file_pattern:
|
||||||
description: File pattern used for "git add"
|
description: File pattern used for `git add`. For example `src/\*.js`
|
||||||
required: false
|
required: false
|
||||||
default: '.'
|
default: '.'
|
||||||
repository:
|
repository:
|
||||||
description: Path to git repository
|
description: Local file path to the git repository. Defaults to the current directory (`.`)
|
||||||
required: false
|
required: false
|
||||||
default: '.'
|
default: '.'
|
||||||
|
commit_user_name:
|
||||||
|
description: Name used for the commit user
|
||||||
|
required: false
|
||||||
|
default: GitHub Actions
|
||||||
|
commit_user_email:
|
||||||
|
description: Email address used for the commit user
|
||||||
|
required: false
|
||||||
|
default: actions@github.com
|
||||||
|
commit_author:
|
||||||
|
description: Value used for the commit author. Defaults to the username of whoever triggered this workflow run.
|
||||||
|
required: false
|
||||||
|
default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
|
@ -33,8 +33,8 @@ _git_is_dirty() {
|
|||||||
|
|
||||||
# Set up git user configuration
|
# Set up git user configuration
|
||||||
_setup_git ( ) {
|
_setup_git ( ) {
|
||||||
git config --global user.email "actions@github.com"
|
git config --global user.name "$INPUT_COMMIT_USER_NAME"
|
||||||
git config --global user.name "GitHub Actions"
|
git config --global user.email "$INPUT_COMMIT_USER_EMAIL"
|
||||||
}
|
}
|
||||||
|
|
||||||
_switch_to_branch() {
|
_switch_to_branch() {
|
||||||
@ -51,7 +51,7 @@ _add_files() {
|
|||||||
|
|
||||||
_local_commit() {
|
_local_commit() {
|
||||||
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}"
|
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}"
|
||||||
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"}
|
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"}
|
||||||
}
|
}
|
||||||
|
|
||||||
_push_to_github() {
|
_push_to_github() {
|
||||||
|
Loading…
Reference in New Issue
Block a user