From 4ab94c0ec4bc2fef4a9ea45a5a6bac2b4657fa6a Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Mon, 13 Jan 2020 21:23:03 +0100 Subject: [PATCH 01/23] Remove creation of .netrc file --- entrypoint.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1fe69fa..2f2195a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,17 +33,6 @@ _git_is_dirty() { # Set up .netrc file with GitHub credentials _setup_git ( ) { - cat <<- EOF > $HOME/.netrc - machine github.com - login $GITHUB_ACTOR - password $GITHUB_TOKEN - - machine api.github.com - login $GITHUB_ACTOR - password $GITHUB_TOKEN -EOF - chmod 600 $HOME/.netrc - git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" } From 35440b938601db796162e289ed6dacfe6dadd72c Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 19:37:00 +0100 Subject: [PATCH 02/23] Update README --- README.md | 52 ++++++++-------------------------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index b68d3d8..0bdb4b4 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,17 @@ 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 . -If no changes are available, the Actions does nothing. +If no changes are detected, the Action does nothing. This Action has been inspired and adapted from the [auto-commit](https://github.com/cds-snc/github-actions/tree/master/auto-commit )-Action of the Canadian Digital Service and this [commit](https://github.com/elstudio/actions-js-build/blob/41d604d6e73d632e22eac40df8cc69b5added04b/commit/entrypoint.sh)-Action by Eric Johnson. -*This action currently can't be used in conjunction with pull requests of forks. See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information.* +*This Action currently can't be used in conjunction with pull requests of forks. See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information.* ## Usage +**Note:** This Action requires that you use `action/checkout@v2` or above to checkout your repository. (Since `v2` the `checkout`-Action persits the auth token in the local git config. Therefore this Action no longer requires that you pass a `GITHUB_TOKEN` to the Action.) + Add the following step at the end of your job. ```yaml @@ -28,13 +30,8 @@ Add the following step at the end of your job. # Optional repository path repository: . - - env: - 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) - The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run! It is recommended to use this Action in Workflows which listen to the `pull_request` event. If you want to use the Action on other events, you have to hardcode the value for `branch` as `github.head_ref` is only available in Pull Requests. @@ -46,9 +43,6 @@ The most common use case for this, is when you're running a Linter or Code-Style In this example I'm running `php-cs-fixer` in a PHP project. - -### Example with `actions/checkout@v2` - ```yaml name: php-cs-fixer @@ -70,46 +64,16 @@ jobs: with: commit_message: Apply php-cs-fixer changes branch: ${{ github.head_ref }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -``` - -### Example with `actions/checkout@v1` - -```yaml -name: php-cs-fixer - -on: - pull_request: - -jobs: - php-cs-fixer: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - - name: Run php-cs-fixer - uses: docker://oskarstark/php-cs-fixer-ga - - - name: Commit changed files - uses: stefanzweifel/git-auto-commit-action@v2.5.0 - with: - commit_message: Apply php-cs-fixer changes - branch: ${{ github.head_ref }} - file_pattern: src/\*.php - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ``` ### Inputs Checkout [`action.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml) for a full list of supported inputs. +## Troubleshooting + +- If your Workflow can't push the commit to the repository because of authentication issues, please update your Workflow configuration and usage of [`ations/checkout`](https://github.com/actions/checkout#usage). (Updating the `token` value with a Personal Access Token should fix your issues) + ## Known Issues - GitHub currently prohibits Actions like this to push changes from a fork to the upstream repository. See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information. From b21b1abc6debb16ec1d153e42fb6a8d0283f789e Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 19:37:58 +0100 Subject: [PATCH 03/23] Update Comment --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2f2195a..eb1b743 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -31,7 +31,7 @@ _git_is_dirty() { [[ -n "$(git status -s)" ]] } -# Set up .netrc file with GitHub credentials +# Set up git user configuration _setup_git ( ) { git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" From 959e7d4eab1040af134332d13615f84c7f1390b8 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 19:42:37 +0100 Subject: [PATCH 04/23] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bdb4b4..6d88705 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This Action has been inspired and adapted from the [auto-commit](https://github. ## Usage -**Note:** This Action requires that you use `action/checkout@v2` or above to checkout your repository. (Since `v2` the `checkout`-Action persits the auth token in the local git config. Therefore this Action no longer requires that you pass a `GITHUB_TOKEN` to the Action.) +**Note:** This Action requires that you use `action/checkout@v2` or above to checkout your repository. Add the following step at the end of your job. From ae384f95d0533199ebeff164e02f58a6d41aa823 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 19:43:08 +0100 Subject: [PATCH 05/23] Update Changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36c56d1..3a1ea45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +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) -> TBD +### 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) + ## [v2.5.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.4.0...v2.5.0) - 2019-12-18 From d47024e59c4f56bdfb776eb65e9d51012a42b78c Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Tue, 4 Feb 2020 20:14:27 +0100 Subject: [PATCH 06/23] 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 07/23] 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 08/23] 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 09/23] 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 10/23] 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 11/23] 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) From b197c5ff8ca7d59ef3cefb8228cdea5ffe686c0c Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:12:20 +0100 Subject: [PATCH 12/23] Set default value for branch --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c5c0b53..f02f682 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,8 @@ inputs: required: true branch: description: Git branch name, where changes should be pushed too. - required: true + required: false + default: ${GITHUB_REF:11} commit_options: description: Commit options (eg. --no-verify) required: false From 5df30c89b8e74245c1235561526f707b4306c930 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:22:54 +0100 Subject: [PATCH 13/23] Update how commit is pushed --- entrypoint.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index c592998..2fa4a55 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,7 +55,12 @@ _local_commit() { } _push_to_github() { - git push --set-upstream origin "HEAD:$INPUT_BRANCH" + if [ -z $INPUT_BRANCH ] + then + git push origin + else + git push --set-upstream origin "HEAD:$INPUT_BRANCH" + fi } _main From e20b39e8edd36f0e14967f9cdd2feca9cad9e5a1 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:24:36 +0100 Subject: [PATCH 14/23] Remove branch default value --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f02f682..5102e64 100644 --- a/action.yml +++ b/action.yml @@ -10,7 +10,7 @@ inputs: branch: description: Git branch name, where changes should be pushed too. required: false - default: ${GITHUB_REF:11} + default: null commit_options: description: Commit options (eg. --no-verify) required: false From 5ab45a4eef1a7dcd53b4289f8f002386c2c97c4b Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:26:30 +0100 Subject: [PATCH 15/23] WIP --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2fa4a55..e5f0533 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -57,9 +57,9 @@ _local_commit() { _push_to_github() { if [ -z $INPUT_BRANCH ] then - git push origin - else git push --set-upstream origin "HEAD:$INPUT_BRANCH" + else + git push origin fi } From 0884c39e7e6e1b783776d298bf4759d9ad753695 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:28:18 +0100 Subject: [PATCH 16/23] WIP --- entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index e5f0533..00674fb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,11 +55,11 @@ _local_commit() { } _push_to_github() { - if [ -z $INPUT_BRANCH ] + if [ -n "$INPUT_BRANCH" ] then - git push --set-upstream origin "HEAD:$INPUT_BRANCH" - else git push origin + else + git push --set-upstream origin "HEAD:$INPUT_BRANCH" fi } From 5a4e81ccd77f2138765b205c8e396dc566190543 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:31:46 +0100 Subject: [PATCH 17/23] WIP --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 00674fb..356b531 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -57,9 +57,9 @@ _local_commit() { _push_to_github() { if [ -n "$INPUT_BRANCH" ] then - git push origin - else git push --set-upstream origin "HEAD:$INPUT_BRANCH" + else + git push origin fi } From af7b14b2cfed28c43705a1982b6a022d01276aa1 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:32:57 +0100 Subject: [PATCH 18/23] WIP --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 356b531..5c5d385 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,7 +55,7 @@ _local_commit() { } _push_to_github() { - if [ -n "$INPUT_BRANCH" ] + if [ -z "$INPUT_BRANCH" ] then git push --set-upstream origin "HEAD:$INPUT_BRANCH" else From f0354eba45d71434798cc504655bb0fb7bf32bd3 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:36:48 +0100 Subject: [PATCH 19/23] WIP --- entrypoint.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5c5d385..930a6da 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,12 +55,14 @@ _local_commit() { } _push_to_github() { - if [ -z "$INPUT_BRANCH" ] - then - git push --set-upstream origin "HEAD:$INPUT_BRANCH" - else - git push origin - fi + git push origin + + # if [ -z "$INPUT_BRANCH" ] + # then + # git push --set-upstream origin "HEAD:$INPUT_BRANCH" + # else + # git push origin + # fi } _main From 42e5be9ebbd72ff55894b76bd923bd7b0fe6ad51 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Wed, 5 Feb 2020 21:39:14 +0100 Subject: [PATCH 20/23] WIP --- action.yml | 2 +- entrypoint.sh | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 5102e64..d239de0 100644 --- a/action.yml +++ b/action.yml @@ -10,7 +10,7 @@ inputs: branch: description: Git branch name, where changes should be pushed too. required: false - default: null + default: '' commit_options: description: Commit options (eg. --no-verify) required: false diff --git a/entrypoint.sh b/entrypoint.sh index 930a6da..00674fb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,14 +55,12 @@ _local_commit() { } _push_to_github() { - git push origin - - # if [ -z "$INPUT_BRANCH" ] - # then - # git push --set-upstream origin "HEAD:$INPUT_BRANCH" - # else - # git push origin - # fi + if [ -n "$INPUT_BRANCH" ] + then + git push origin + else + git push --set-upstream origin "HEAD:$INPUT_BRANCH" + fi } _main From 13e281008a262dcb3f336ae66ed0328ec1322418 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Thu, 6 Feb 2020 17:51:55 +0100 Subject: [PATCH 21/23] Update entrypoint.sh --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 00674fb..87b28bc 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -55,7 +55,7 @@ _local_commit() { } _push_to_github() { - if [ -n "$INPUT_BRANCH" ] + if [ -z "$INPUT_BRANCH" ] then git push origin else From 33592697c4001dd06b1e7f6e0ed4b1daebab767a Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Thu, 6 Feb 2020 20:43:04 +0100 Subject: [PATCH 22/23] Update Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fad98e..d83df0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### 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) +### Changed +- Make the `branch` input option optional [#41](https://github.com/stefanzweifel/git-auto-commit-action/pull/41) + ### 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) From 864c975b874d5cff2680de061168816ce72fd236 Mon Sep 17 00:00:00 2001 From: Stefan Zweifel Date: Thu, 6 Feb 2020 20:49:03 +0100 Subject: [PATCH 23/23] Update README --- README.md | 27 +++++++++++++++++++++++++-- action.yml | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f32de1f..04332b6 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,12 @@ 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@v2.5.0 +- uses: stefanzweifel/git-auto-commit-action@v3.0.0 with: commit_message: Apply automatic changes + + # Optional name of the branch the commit should be pushed to + # Required if Action is used in Workflow listening to the `pull_request` event branch: ${{ github.head_ref }} # Optional git params @@ -65,12 +68,32 @@ jobs: - name: Run php-cs-fixer uses: docker://oskarstark/php-cs-fixer-ga - - uses: stefanzweifel/git-auto-commit-action@v2.5.0 + - uses: stefanzweifel/git-auto-commit-action@v3.0.0 with: commit_message: Apply php-cs-fixer changes branch: ${{ github.head_ref }} ``` +```yaml +name: php-cs-fixer + +on: push + +jobs: + php-cs-fixer: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run php-cs-fixer + uses: docker://oskarstark/php-cs-fixer-ga + + - uses: stefanzweifel/git-auto-commit-action@v3.0.0 + with: + commit_message: Apply php-cs-fixer changes +``` + ### Inputs Checkout [`action.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml) for a full list of supported inputs. diff --git a/action.yml b/action.yml index d239de0..4988a84 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,7 @@ inputs: description: Commit message required: true branch: - description: Git branch name, where changes should be pushed too. + description: Git branch name, where changes should be pushed too. Required if Action is used on the `pull_request` event required: false default: '' commit_options: