Skip to content

Commit

Permalink
add cpina#92
Browse files Browse the repository at this point in the history
  • Loading branch information
o3-shop-user committed Jan 11, 2024
1 parent 07c4d7b commit ea023b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ inputs:
description: '[Optional] The directory to wipe and replace in the target repository'
default: ''
required: false
tag-name:
description: '[Optional] Add a tag to the commit'
default: ''
required: false
create-target-branch-if-needed:
type: boolean
description: >-
Expand All @@ -71,6 +75,7 @@ runs:
- '${{ inputs.commit-message }}'
- '${{ inputs.target-directory }}'
- '${{ inputs.create-target-branch-if-needed }}'
- '${{ inputs.tag-name }}'
branding:
icon: git-commit
color: green
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ TARGET_BRANCH="${9}"
COMMIT_MESSAGE="${10}"
TARGET_DIRECTORY="${11}"
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
TAG_NAME="${13}"

if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
then
Expand Down Expand Up @@ -170,6 +171,12 @@ echo "[+] git diff-index:"
# git diff-index : to avoid doing the git commit failing if there are no changes to be commit
git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE"

if [ -n "${TAG_NAME}" ]
then
git tag -a $TAG_NAME -m ""
git config --global push.followTags true
fi

echo "[+] Pushing git commit"
# --set-upstream: sets de branch when pushing to a branch that does not exist
git push "$GIT_CMD_REPOSITORY" --set-upstream "$TARGET_BRANCH"

0 comments on commit ea023b8

Please sign in to comment.