mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-05 00:05:45 -06:00
Merge c51ed22a0c9c6f3ff11c4f241246e7a0384e6b76 into 7c1bd869f38327ce403753fc2a5769e26cacb5ac
This commit is contained in:
commit
3aa9889a2d
@ -54,6 +54,10 @@ inputs:
|
|||||||
[Optional] create target branch if not exist. Defaults to `false`
|
[Optional] create target branch if not exist. Defaults to `false`
|
||||||
default: false
|
default: false
|
||||||
required: false
|
required: false
|
||||||
|
tag-name:
|
||||||
|
description: '[Optional] Add a tag to the commit'
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
@ -71,6 +75,7 @@ runs:
|
|||||||
- '${{ inputs.commit-message }}'
|
- '${{ inputs.commit-message }}'
|
||||||
- '${{ inputs.target-directory }}'
|
- '${{ inputs.target-directory }}'
|
||||||
- '${{ inputs.create-target-branch-if-needed }}'
|
- '${{ inputs.create-target-branch-if-needed }}'
|
||||||
|
- '${{ inputs.tag-name }}'
|
||||||
branding:
|
branding:
|
||||||
icon: git-commit
|
icon: git-commit
|
||||||
color: green
|
color: green
|
||||||
|
@ -16,6 +16,7 @@ TARGET_BRANCH="${9}"
|
|||||||
COMMIT_MESSAGE="${10}"
|
COMMIT_MESSAGE="${10}"
|
||||||
TARGET_DIRECTORY="${11}"
|
TARGET_DIRECTORY="${11}"
|
||||||
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
|
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
|
||||||
|
TAG_NAME="${13}"
|
||||||
|
|
||||||
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
||||||
then
|
then
|
||||||
@ -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 : 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"
|
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"
|
echo "[+] Pushing git commit"
|
||||||
# --set-upstream: sets de branch when pushing to a branch that does not exist
|
# --set-upstream: sets de branch when pushing to a branch that does not exist
|
||||||
git push "$GIT_CMD_REPOSITORY" --set-upstream "$TARGET_BRANCH"
|
git push "$GIT_CMD_REPOSITORY" --set-upstream "$TARGET_BRANCH"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user