mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-05 08:05:47 -06:00
Merge 88d92aa7901fd0ba31b5fa40af5a259632bbf582 into 0a14457bb28b04dfa1652e0ffdfda866d2845c73
This commit is contained in:
commit
9c716043be
@ -48,6 +48,10 @@ inputs:
|
|||||||
description: '[Optional] The directory to wipe and replace in the target repository'
|
description: '[Optional] The directory to wipe and replace in the target repository'
|
||||||
default: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
|
tag-name:
|
||||||
|
description: '[Optional] Add a tag to the commit'
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
@ -64,6 +68,7 @@ runs:
|
|||||||
- '${{ inputs.target-branch }}'
|
- '${{ inputs.target-branch }}'
|
||||||
- '${{ inputs.commit-message }}'
|
- '${{ inputs.commit-message }}'
|
||||||
- '${{ inputs.target-directory }}'
|
- '${{ inputs.target-directory }}'
|
||||||
|
- '${{ inputs.tag-name }}'
|
||||||
branding:
|
branding:
|
||||||
icon: git-commit
|
icon: git-commit
|
||||||
color: green
|
color: green
|
||||||
|
@ -15,6 +15,7 @@ DESTINATION_REPOSITORY_USERNAME="${8}"
|
|||||||
TARGET_BRANCH="${9}"
|
TARGET_BRANCH="${9}"
|
||||||
COMMIT_MESSAGE="${10}"
|
COMMIT_MESSAGE="${10}"
|
||||||
TARGET_DIRECTORY="${11}"
|
TARGET_DIRECTORY="${11}"
|
||||||
|
TAG_NAME="${12}"
|
||||||
|
|
||||||
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
||||||
then
|
then
|
||||||
@ -147,6 +148,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