Update action.yml
This commit is contained in:
parent
15230b93b5
commit
dc2a83bdf6
1 changed files with 2 additions and 16 deletions
18
action.yml
18
action.yml
|
@ -85,29 +85,15 @@ runs:
|
||||||
git config --local user.name "${{ inputs.name }}"
|
git config --local user.name "${{ inputs.name }}"
|
||||||
|
|
||||||
if [[ `git status --porcelain` ]]; then
|
if [[ `git status --porcelain` ]]; then
|
||||||
REGEX="^(https|git)(:\/\/|@)([^\/:]+)[\/:]([^\/:]+)\/(.+)$"
|
|
||||||
if [[ ${{ inputs.remote_repository }} =~ $REGEX ]]; then
|
|
||||||
PROTOCOL=${BASH_REMATCH[1]}
|
|
||||||
SEPARATOR=${BASH_REMATCH[2]}
|
|
||||||
HOSTNAME=${BASH_REMATCH[3]}
|
|
||||||
DESTINATION_OWNER=${BASH_REMATCH[4]}
|
|
||||||
DESTINATION_REPOSITORY=${BASH_REMATCH[5]}
|
|
||||||
DESTINATION_REPOSITORY=${DESTINATION_REPOSITORY//.git/ }
|
|
||||||
REMOTE_URL=https://$DESTINATION_OWNER:${{ inputs.access_token }}@github.com/$DESTINATION_OWNER/$DESTINATION_REPOSITORY
|
|
||||||
git remote set-url origin $REMOTE_URL
|
|
||||||
git fetch origin
|
|
||||||
fi
|
|
||||||
|
|
||||||
git add ${{ inputs.files }} -v
|
git add ${{ inputs.files }} -v
|
||||||
git commit -m "${{ inputs.commit_message }}" $EMPTY
|
git commit -m "${{ inputs.commit_message }}" $EMPTY
|
||||||
git branch push-and-commit-action-${{ github.run_id }}-${{ github.job }}
|
git branch push-and-commit-action-${{ github.run_id }}-${{ github.job }}
|
||||||
git fetch "$REMOTE_URL" "$CURRENT_BRANCH"
|
git fetch "${{ inputs.remote_repository }}" "$CURRENT_BRANCH"
|
||||||
git checkout "$CURRENT_BRANCH"
|
git checkout "$CURRENT_BRANCH"
|
||||||
git merge push-and-commit-action-${{ github.run_id }}-${{ github.job }}
|
git merge push-and-commit-action-${{ github.run_id }}-${{ github.job }}
|
||||||
git branch -d push-and-commit-action-${{ github.run_id }}-${{ github.job }}
|
git branch -d push-and-commit-action-${{ github.run_id }}-${{ github.job }}
|
||||||
|
|
||||||
git push origin "$CURRENT_BRANCH:$TARGET_BRANCH" --follow-tags $FORCE $TAGS
|
git push "${{ inputs.remote_repository }}" "$CURRENT_BRANCH:$TARGET_BRANCH" --follow-tags $FORCE $TAGS
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "WARNING: No changes were detected. git commit push action aborted."
|
echo "WARNING: No changes were detected. git commit push action aborted."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue