mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2024-12-06 02:09:04 +00:00
Merge pull request #7 from stefanzweifel/fix-branch-checkout
Bugfix: Fix git checkout and git push commands
This commit is contained in:
commit
8a0c95d76c
@ -18,6 +18,7 @@ Add the following step at the end of your job.
|
||||
commit_author_email: john.doe@example.com
|
||||
commit_author_name: John Doe
|
||||
commit_message: Apply automatic changes
|
||||
ref: ${{ github.head_ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
@ -32,6 +33,7 @@ The following inputs are required
|
||||
- `commit_author_email`: The Commit Authors Email Address
|
||||
- `commit_author_name`: The Commit Authors Name
|
||||
- `commit_message`: The commit message used when changes are available
|
||||
- `ref`: Branch where changes should be pushed too
|
||||
|
||||
### Environment Variables
|
||||
|
||||
|
@ -5,13 +5,16 @@ author: Stefan Zweifel <hello@stefanzweifel.io>
|
||||
|
||||
inputs:
|
||||
commit_message:
|
||||
description: 'Commit message'
|
||||
description: Commit message
|
||||
required: true
|
||||
commit_author_name:
|
||||
description: 'Name of the commit author'
|
||||
description: Name of the commit author
|
||||
required: true
|
||||
commit_author_email:
|
||||
description: 'Email address of the commit author'
|
||||
description: Email address of the commit author
|
||||
required: true
|
||||
ref:
|
||||
description: Branch where changes should be pushed too
|
||||
required: true
|
||||
|
||||
runs:
|
||||
|
@ -25,14 +25,16 @@ if ! git diff --quiet
|
||||
then
|
||||
git_setup
|
||||
|
||||
echo "INPUT_REF value: $INPUT_REF";
|
||||
|
||||
# Switch to branch from current Workflow run
|
||||
git checkout "${GITHUB_REF:11}"
|
||||
git checkout $INPUT_REF
|
||||
|
||||
git add .
|
||||
|
||||
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR_NAME <$INPUT_COMMIT_AUTHOR_EMAIL>"
|
||||
|
||||
git push --set-upstream origin "${GITHUB_REF:11}"
|
||||
git push --set-upstream origin "HEAD:$INPUT_REF"
|
||||
else
|
||||
echo "Working tree clean. Nothing to commit."
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user