diff --git a/README.md b/README.md index f2c909e..5eef900 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,10 @@ The following is an extended example with all available options. ```yaml - uses: stefanzweifel/git-auto-commit-action@v5 with: + # Perform a clean git tag and push, without commiting anything + # Default to false + git_tag_only: false + # Optional. Commit message for the created commit. # Defaults to "Apply automatic changes" commit_message: Automated Change diff --git a/action.yml b/action.yml index fe8bfb3..2b8ea38 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,10 @@ description: 'Automatically commits files which have been changed during the wor author: Stefan Zweifel inputs: + git_tag_only: + description: Perform a clean git tag and push, without commiting anything + required: false + default: false commit_message: description: Commit message required: false diff --git a/entrypoint.sh b/entrypoint.sh index bff98e0..ee26146 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,8 +30,12 @@ _main() { _check_if_git_is_available _switch_to_repository - - if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then + if "$INPUT_GIT_TAG_ONLY"; then + _log "debug" "git tag only."; + _set_github_output "git_tag_only" "true" + _tag_commit + _push_to_github + elif _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; then _set_github_output "changes_detected" "true" diff --git a/tests/git-auto-commit.bats b/tests/git-auto-commit.bats index d08597c..26f6de3 100644 --- a/tests/git-auto-commit.bats +++ b/tests/git-auto-commit.bats @@ -21,6 +21,7 @@ setup() { export FAKE_DEFAULT_BRANCH=$(git config init.defaultBranch) # Set default INPUT variables used by the GitHub Action + export INPUT_GIT_TAG_ONLY=false export INPUT_REPOSITORY="${FAKE_LOCAL_REPOSITORY}" export INPUT_COMMIT_MESSAGE="Commit Message" export INPUT_BRANCH="${FAKE_DEFAULT_BRANCH}"