Merge pull request #364 from zmynx/master

feat: allow for clean tag pushing
This commit is contained in:
Stefan Zweifel 2025-04-19 10:23:02 +02:00 committed by GitHub
commit 11a6e5f38f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View File

@ -58,6 +58,10 @@ The following is an extended example with all available options.
```yaml ```yaml
- uses: stefanzweifel/git-auto-commit-action@v5 - uses: stefanzweifel/git-auto-commit-action@v5
with: 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. # Optional. Commit message for the created commit.
# Defaults to "Apply automatic changes" # Defaults to "Apply automatic changes"
commit_message: Automated Change commit_message: Automated Change

View File

@ -4,6 +4,10 @@ description: 'Automatically commits files which have been changed during the wor
author: Stefan Zweifel <stefan@stefanzweifel.dev> author: Stefan Zweifel <stefan@stefanzweifel.dev>
inputs: inputs:
git_tag_only:
description: Perform a clean git tag and push, without commiting anything
required: false
default: false
commit_message: commit_message:
description: Commit message description: Commit message
required: false required: false

View File

@ -30,8 +30,12 @@ _main() {
_check_if_git_is_available _check_if_git_is_available
_switch_to_repository _switch_to_repository
if "$INPUT_GIT_TAG_ONLY"; then
if _git_is_dirty || "$INPUT_SKIP_DIRTY_CHECK"; 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" _set_github_output "changes_detected" "true"

View File

@ -21,6 +21,7 @@ setup() {
export FAKE_DEFAULT_BRANCH=$(git config init.defaultBranch) export FAKE_DEFAULT_BRANCH=$(git config init.defaultBranch)
# Set default INPUT variables used by the GitHub Action # Set default INPUT variables used by the GitHub Action
export INPUT_GIT_TAG_ONLY=false
export INPUT_REPOSITORY="${FAKE_LOCAL_REPOSITORY}" export INPUT_REPOSITORY="${FAKE_LOCAL_REPOSITORY}"
export INPUT_COMMIT_MESSAGE="Commit Message" export INPUT_COMMIT_MESSAGE="Commit Message"
export INPUT_BRANCH="${FAKE_DEFAULT_BRANCH}" export INPUT_BRANCH="${FAKE_DEFAULT_BRANCH}"