Compare commits

...

17 Commits

Author SHA1 Message Date
Stefan Zweifel
0ef5bf58dc Tag v2.3.0 2019-11-04 20:07:50 +01:00
Stefan Zweifel
e924b16154 Merge pull request #15 from gomorizsolt/issue-14_support-custom-git-params
Support custom git params.
Fixes #14
2019-11-04 20:04:09 +01:00
Gömöri Zsolt
2fb839c669 Remove is_defined() 2019-11-01 11:11:19 +01:00
Gömöri Zsolt
908446c002 Use :+ to avoid empty string 2019-11-01 11:03:23 +01:00
Gömöri Zsolt
2d23a29775 Use one-line if statement 2019-11-01 10:53:56 +01:00
Gömöri Zsolt
bdc88aff2c Re-add is_defined() to eliminate empty string in git commit 2019-11-01 10:44:09 +01:00
Gömöri Zsolt
ddcd35eaa8 Remove is_defined() approach 2019-11-01 10:19:20 +01:00
Gömöri Zsolt
760c9be2dc Define default value for file_pattern 2019-11-01 10:15:22 +01:00
Gömöri Zsolt
69d0349561 Log input params beforehand 2019-11-01 10:10:52 +01:00
Gömöri Zsolt
eecee2898e Follow GH Action's naming restrictions 2019-11-01 10:04:42 +01:00
Gömöri Zsolt
3889fd6a6c Add args entry to actions.yml 2019-11-01 09:51:54 +01:00
Gömöri Zsolt
1ad5315ba7 Fix log statement 2019-11-01 09:51:19 +01:00
gomorizsolt
fa043bd474 Remove junk code 2019-10-31 15:13:27 +01:00
gomorizsolt
af33cfbb5c Replace get_value with is_defined altogether 2019-10-31 14:49:38 +01:00
gomorizsolt
677efa2969 Remove blank line 2019-10-31 11:25:08 +01:00
gomorizsolt
b6dcf94303 Add is_defined and get_value to improve on code's reusability 2019-10-31 11:18:48 +01:00
gomorizsolt
a65a3a47cd Support commit options, update README.md accordingly 2019-10-31 09:02:56 +01:00
4 changed files with 25 additions and 12 deletions

View File

@@ -4,7 +4,11 @@ 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/v2.2.0...HEAD) ## [Unreleased](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.3.0...HEAD)
## [v2.3.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.2.0...v2.3.0) - 2019-11-04
- Add a new `commit_option`-argument. Allows users to define additional commit options for the `git-commit` command. [#14](https://github.com/stefanzweifel/git-auto-commit-action/pull/15)
## [v2.2.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.1.0...v2.2.0) - 2019-10-26 ## [v2.2.0](https://github.com/stefanzweifel/git-auto-commit-action/compare/v2.1.0...v2.2.0) - 2019-10-26

View File

@@ -13,11 +13,14 @@ This Action has been inspired and adapted from the [auto-commit](https://github.
Add the following step at the end of your job. Add the following step at the end of your job.
```yaml ```yaml
- uses: stefanzweifel/git-auto-commit-action@v2.2.0 - uses: stefanzweifel/git-auto-commit-action@v2.3.0
with: with:
commit_message: Apply automatic changes commit_message: Apply automatic changes
branch: ${{ github.head_ref }} branch: ${{ github.head_ref }}
# Optional git params
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
file_pattern: src/\*.js file_pattern: src/\*.js
env: env:
@@ -59,7 +62,7 @@ jobs:
uses: docker://oskarstark/php-cs-fixer-ga uses: docker://oskarstark/php-cs-fixer-ga
- name: Commit changed files - name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v2.2.0 uses: stefanzweifel/git-auto-commit-action@v2.3.0
with: with:
commit_message: Apply php-cs-fixer changes commit_message: Apply php-cs-fixer changes
branch: ${{ github.head_ref }} branch: ${{ github.head_ref }}

View File

@@ -7,6 +7,9 @@ inputs:
commit_message: commit_message:
description: Commit message description: Commit message
required: true required: true
commit_options:
description: Commit options
required: false
branch: branch:
description: Branch where changes should be pushed too description: Branch where changes should be pushed too
required: true required: true
@@ -18,6 +21,11 @@ inputs:
runs: runs:
using: 'docker' using: 'docker'
image: 'Dockerfile' image: 'Dockerfile'
args:
- ${{ inputs.commit_message }}
- ${{ inputs.commit_options }}
- ${{ inputs.branch }}
- ${{ inputs.file_pattern }}
branding: branding:
icon: 'git-commit' icon: 'git-commit'

View File

@@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
# Set up .netrc file with GitHub credentials # Set up .netrc file with GitHub credentials
@@ -18,7 +19,6 @@ EOF
git config --global user.name "GitHub Actions" git config --global user.name "GitHub Actions"
} }
# This section only runs if there have been file changes # This section only runs if there have been file changes
echo "Checking for uncommitted changes in the git working tree." echo "Checking for uncommitted changes in the git working tree."
if ! git diff --quiet if ! git diff --quiet
@@ -30,15 +30,13 @@ then
# Switch to branch from current Workflow run # Switch to branch from current Workflow run
git checkout $INPUT_BRANCH git checkout $INPUT_BRANCH
if [ -z ${INPUT_FILE_PATTERN+x} ]; echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}"
then
git add .
else
echo "INPUT_FILE_PATTERN value: $INPUT_FILE_PATTERN";
git add $INPUT_FILE_PATTERN
fi
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" git add "${INPUT_FILE_PATTERN}"
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 push --set-upstream origin "HEAD:$INPUT_BRANCH" git push --set-upstream origin "HEAD:$INPUT_BRANCH"
else else