Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #309 #310

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ _NOTE: set the fetch-depth for `actions/checkout@v2` or newer to be sure you ret
- `last`: show the single last commit
- `compare`: show all commits since previous repo tag number
- **FORCE_WITHOUT_CHANGES** _(optional)_ - Enforce the brach creation even if there are no changes from the tag.
- **FORCE_WITHOUT_CHANGES_PRE** _(optional)_ - Similar to force without changes, for pre-releases.

### Outputs

Expand Down
10 changes: 6 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ patch_string_token=${PATCH_STRING_TOKEN:-#patch}
none_string_token=${NONE_STRING_TOKEN:-#none}
branch_history=${BRANCH_HISTORY:-compare}
force_without_changes=${FORCE_WITHOUT_CHANGES:-false}
force_without_changes_pre=${FORCE_WITHOUT_CHANGES:-false}

# since https://github.blog/2022-04-12-git-security-vulnerability-announced/ runner uses?
git config --global --add safe.directory /github/workspace
Expand All @@ -47,7 +48,8 @@ echo -e "\tMINOR_STRING_TOKEN: ${minor_string_token}"
echo -e "\tPATCH_STRING_TOKEN: ${patch_string_token}"
echo -e "\tNONE_STRING_TOKEN: ${none_string_token}"
echo -e "\tBRANCH_HISTORY: ${branch_history}"
echo -e "\tFORCE: ${force_without_changes}"
echo -e "\tFORCE_WITHOUT_CHANGES: ${force_without_changes}"
echo -e "\tFORCE_WITHOUT_CHANGES_PRE: ${force_without_changes_pre}"

# verbose, show everything
if $verbose
Expand Down Expand Up @@ -127,7 +129,7 @@ tag_commit=$(git rev-list -n 1 "$tag" || true )
# get current commit hash
commit=$(git rev-parse HEAD)
# skip if there are no new commits for non-pre_release
if [ "$tag_commit" == "$commit" ] && [ "$force_without_changes" == "false" ]
if [ "$tag_commit" == "$commit" ] && [ "$force_without_changes" == "false" ]
then
echo "No new commits since previous tag. Skipping..."
setOutput "new_tag" "$tag"
Expand Down Expand Up @@ -190,7 +192,7 @@ then
# get current commit hash for tag
pre_tag_commit=$(git rev-list -n 1 "$pre_tag" || true)
# skip if there are no new commits for pre_release
if [ "$pre_tag_commit" == "$commit" ]
if [ "$pre_tag_commit" == "$commit" ] && [ "$pre_force_without_changes" == "false" ]
then
echo "No new commits since previous pre_tag. Skipping..."
setOutput "new_tag" "$pre_tag"
Expand Down Expand Up @@ -281,4 +283,4 @@ EOF
else
# use git cli to push
git push -f origin "$new" || exit 1
fi
fi