From 99f6ce74b416beed38496617c27752af8355eb51 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 14 Jan 2020 14:44:34 +0100 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b68d3d8..36dafab 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Add the following step at the end of your job. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -You **do not** have to create a new secret called `GITHUB_TOKEN` in your repository. `GITHUB_TOKEN` is a special token GitHub creates automatically during a Workflow run. (See [the documentation](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for details) +You **do not** have to create a new secret called `GITHUB_TOKEN` in your repository. `GITHUB_TOKEN` is a special token GitHub creates automatically during a Workflow run. (See [the documentation](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token) for details) The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run! From d47024e59c4f56bdfb776eb65e9d51012a42b78c Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 20:14:27 +0100 Subject: [PATCH 2/7] Add commit_user_name and commit_user_email inputs --- README.md | 4 ++++ action.yml | 8 ++++++++ entrypoint.sh | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36dafab..cdf734e 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ Add the following step at the end of your job. # Optional repository path repository: . + # Optional commit user settings + commit_user_name: My GitHub Actions Bot + commit_user_email: my-github-actions-bot@example.org + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` diff --git a/action.yml b/action.yml index 2fb26e7..d8a27aa 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,14 @@ inputs: description: Path to git repository required: false 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 runs: using: 'docker' diff --git a/entrypoint.sh b/entrypoint.sh index 1fe69fa..f1e75c0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,8 +44,8 @@ _setup_git ( ) { EOF chmod 600 $HOME/.netrc - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" + git config --global user.name "$INPUT_COMMIT_USER_NAME" + git config --global user.email "$INPUT_COMMIT_USER_EMAIL" } _switch_to_branch() { From 0822a9b930dc5cea100f9afc78b7228dac72fce9 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 21:02:40 +0100 Subject: [PATCH 3/7] Add commit_author input option --- action.yml | 4 ++++ entrypoint.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d8a27aa..7fd5e8d 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,10 @@ inputs: description: Email address used for the commit user required: false default: actions@github.com + commit_author: + description: Value used for the commit author + required: false + default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> runs: using: 'docker' diff --git a/entrypoint.sh b/entrypoint.sh index f1e75c0..fbc29af 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -62,7 +62,7 @@ _add_files() { _local_commit() { 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() { From 3c60dc19b2c0df5e0bde65d3769ba8d26b293d19 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 21:27:15 +0100 Subject: [PATCH 4/7] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cdf734e..716136e 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Add the following step at the end of your job. # Optional commit user settings commit_user_name: My GitHub Actions Bot commit_user_email: my-github-actions-bot@example.org + commit_author: Author env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 5432544bdb73ae9eeeeb763f934bbb33bca3a0d6 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 20:24:25 +0100 Subject: [PATCH 5/7] Update Docs --- README.md | 4 ++-- action.yml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c190d45..b4368f8 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ Add the following step at the end of your job. # Optional glob pattern of files which should be added to the commit file_pattern: src/\*.js - # Optional repository path + # Optional local file path to the repository repository: . - # Optional commit user settings + # 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 diff --git a/action.yml b/action.yml index 7fd5e8d..c5c0b53 100644 --- a/action.yml +++ b/action.yml @@ -7,18 +7,18 @@ inputs: commit_message: description: Commit message required: true + branch: + description: Git branch name, where changes should be pushed too. + required: true commit_options: description: Commit options (eg. --no-verify) required: false - branch: - description: Branch name where changes should be pushed too - required: true file_pattern: - description: File pattern used for "git add" + description: File pattern used for `git add`. For example `src/\*.js` required: false default: '.' repository: - description: Path to git repository + description: Local file path to the git repository. Defaults to the current directory (`.`) required: false default: '.' commit_user_name: @@ -30,7 +30,7 @@ inputs: required: false default: actions@github.com commit_author: - description: Value used for the 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> From 3185f2bd2a69d21bbaa44279ac5a0af960a0648c Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 20:27:14 +0100 Subject: [PATCH 6/7] Update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b4368f8..f32de1f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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. -The Committer is "GitHub Actions " and the Author of the Commit is "Your GitHub Username . +This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the commit back to GitHub. +The default committer is "GitHub Actions " and the default author of the commit is "Your GitHub Username ". If no changes are detected, the Action does nothing. From a06032e34f06ce330bf189f5f3c3f3dc5ca12a57 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 20:36:12 +0100 Subject: [PATCH 7/7] Update Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a1ea45..1fad98e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) +### 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 - 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)