Skip to content

Commit e924b16

Browse files
Merge pull request #15 from gomorizsolt/issue-14_support-custom-git-params
Support custom git params. Fixes #14
2 parents a607c57 + 2fb839c commit e924b16

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Add the following step at the end of your job.
1818
commit_message: Apply automatic changes
1919
branch: ${{ github.head_ref }}
2020

21+
# Optional git params
22+
commit_options: '--no-verify --signoff'
23+
2124
# Optional glob pattern of files which should be added to the commit
2225
file_pattern: src/\*.js
2326
env:

actions.yml renamed to action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ inputs:
77
commit_message:
88
description: Commit message
99
required: true
10+
commit_options:
11+
description: Commit options
12+
required: false
1013
branch:
1114
description: Branch where changes should be pushed too
1215
required: true
@@ -18,6 +21,11 @@ inputs:
1821
runs:
1922
using: 'docker'
2023
image: 'Dockerfile'
24+
args:
25+
- ${{ inputs.commit_message }}
26+
- ${{ inputs.commit_options }}
27+
- ${{ inputs.branch }}
28+
- ${{ inputs.file_pattern }}
2129

2230
branding:
2331
icon: 'git-commit'

entrypoint.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
23
set -eu
34

45
# Set up .netrc file with GitHub credentials
@@ -18,7 +19,6 @@ EOF
1819
git config --global user.name "GitHub Actions"
1920
}
2021

21-
2222
# This section only runs if there have been file changes
2323
echo "Checking for uncommitted changes in the git working tree."
2424
if ! git diff --quiet
@@ -30,15 +30,13 @@ then
3030
# Switch to branch from current Workflow run
3131
git checkout $INPUT_BRANCH
3232

33-
if [ -z ${INPUT_FILE_PATTERN+x} ];
34-
then
35-
git add .
36-
else
37-
echo "INPUT_FILE_PATTERN value: $INPUT_FILE_PATTERN";
38-
git add $INPUT_FILE_PATTERN
39-
fi
33+
echo "INPUT_FILE_PATTERN: ${INPUT_FILE_PATTERN}"
34+
35+
git add "${INPUT_FILE_PATTERN}"
36+
37+
echo "INPUT_COMMIT_OPTIONS: ${INPUT_COMMIT_OPTIONS}"
4038

41-
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
39+
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"}
4240

4341
git push --set-upstream origin "HEAD:$INPUT_BRANCH"
4442
else

0 commit comments

Comments
 (0)