diff --git a/README.md b/README.md index 728c5ab..a287fcd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/actions.yml b/actions.yml index 84af776..2afa7bd 100644 --- a/actions.yml +++ b/actions.yml @@ -5,13 +5,16 @@ author: Stefan Zweifel 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: diff --git a/entrypoint.sh b/entrypoint.sh index 58fe291..2c7d76d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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