Rename ref to branch

This commit is contained in:
Stefan Zweifel 2019-09-20 20:26:41 +02:00
parent 8a0c95d76c
commit 97f9868da0
3 changed files with 7 additions and 6 deletions

View File

@ -18,7 +18,7 @@ Add the following step at the end of your job.
commit_author_email: john.doe@example.com commit_author_email: john.doe@example.com
commit_author_name: John Doe commit_author_name: John Doe
commit_message: Apply automatic changes commit_message: Apply automatic changes
ref: ${{ github.head_ref }} branch: ${{ github.head_ref }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
``` ```
@ -33,7 +33,7 @@ The following inputs are required
- `commit_author_email`: The Commit Authors Email Address - `commit_author_email`: The Commit Authors Email Address
- `commit_author_name`: The Commit Authors Name - `commit_author_name`: The Commit Authors Name
- `commit_message`: The commit message used when changes are available - `commit_message`: The commit message used when changes are available
- `ref`: Branch where changes should be pushed too - `branch`: Branch name where changes should be pushed to
### Environment Variables ### Environment Variables
@ -68,6 +68,7 @@ jobs:
commit_author_email: hello@stefanzweifel.io commit_author_email: hello@stefanzweifel.io
commit_author_name: Stefan Zweifel commit_author_name: Stefan Zweifel
commit_message: Apply php-cs-fixer changes commit_message: Apply php-cs-fixer changes
branch: ${{ github.head_ref }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -13,7 +13,7 @@ inputs:
commit_author_email: commit_author_email:
description: Email address of the commit author description: Email address of the commit author
required: true required: true
ref: branch:
description: Branch where changes should be pushed too description: Branch where changes should be pushed too
required: true required: true

View File

@ -25,16 +25,16 @@ if ! git diff --quiet
then then
git_setup git_setup
echo "INPUT_REF value: $INPUT_REF"; echo "INPUT_BRANCH value: $INPUT_BRANCH";
# Switch to branch from current Workflow run # Switch to branch from current Workflow run
git checkout $INPUT_REF git checkout $INPUT_BRANCH
git add . git add .
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR_NAME <$INPUT_COMMIT_AUTHOR_EMAIL>" git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR_NAME <$INPUT_COMMIT_AUTHOR_EMAIL>"
git push --set-upstream origin "HEAD:$INPUT_REF" git push --set-upstream origin "HEAD:$INPUT_BRANCH"
else else
echo "Working tree clean. Nothing to commit." echo "Working tree clean. Nothing to commit."
fi fi