Add tagging_message input option

This commit is contained in:
Stefan Zweifel 2020-03-05 20:31:06 +01:00
parent d4a53f1779
commit 3387b2f267
3 changed files with 18 additions and 0 deletions

View File

@ -38,6 +38,9 @@ Add the following step at the end of your job.
commit_user_name: My GitHub Actions Bot commit_user_name: My GitHub Actions Bot
commit_user_email: my-github-actions-bot@example.org commit_user_email: my-github-actions-bot@example.org
commit_author: Author <actions@gitub.com> commit_author: Author <actions@gitub.com>
# Optional. If value is set, the commit will be tagged with the given value
tagging_message: 'v1.0.0'
``` ```
The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run! The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run!

View File

@ -34,6 +34,10 @@ inputs:
description: Value used for the commit author. Defaults to the username of whoever triggered this workflow run. description: Value used for the commit author. Defaults to the username of whoever triggered this workflow run.
required: false required: false
default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
tagging_message:
description: Value used for a git tag. Keep it empty to not tag the commit.
required: false
default: ''
outputs: outputs:
changes_detected: changes_detected:

View File

@ -17,6 +17,8 @@ _main() {
_local_commit _local_commit
_tag_commit
_push_to_github _push_to_github
else else
@ -59,6 +61,15 @@ _local_commit() {
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"} git commit -m "$INPUT_COMMIT_MESSAGE" --author="$INPUT_COMMIT_AUTHOR" ${INPUT_COMMIT_OPTIONS:+"$INPUT_COMMIT_OPTIONS"}
} }
_tag_commit() {
if [ -z "$INPUT_TAGGING_MESSAGE" ]
then
# No tag name given. Do nothing.
else
git tag -a "$INPUT_TAGGING_MESSAGE" -m "$INPUT_TAGGING_MESSAGE"
fi
}
_push_to_github() { _push_to_github() {
if [ -z "$INPUT_BRANCH" ] if [ -z "$INPUT_BRANCH" ]
then then