mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2024-12-06 02:09:04 +00:00
Merge pull request #15 from gomorizsolt/issue-14_support-custom-git-params
Support custom git params. Fixes #14
This commit is contained in:
commit
e924b16154
@ -18,6 +18,9 @@ Add the following step at the end of your job.
|
|||||||
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:
|
||||||
|
@ -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'
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user