Merge 785fccdc08b61744fc7c4b944b966caaf42bc9ab into 7c1bd869f38327ce403753fc2a5769e26cacb5ac

This commit is contained in:
Pavel Sukhodolski 2024-09-16 09:21:02 +01:00 committed by GitHub
commit e5a6ebec5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -54,6 +54,10 @@ inputs:
[Optional] create target branch if not exist. Defaults to `false`
default: false
required: false
exclude-directories:
description: '[Optional] The directory to exclude for remove from remote repo'
default: ''
required: false
runs:
using: docker
@ -71,6 +75,7 @@ runs:
- '${{ inputs.commit-message }}'
- '${{ inputs.target-directory }}'
- '${{ inputs.create-target-branch-if-needed }}'
- '${{ inputs.exclude-directories }}'
branding:
icon: git-commit
color: green

View File

@ -16,6 +16,7 @@ TARGET_BRANCH="${9}"
COMMIT_MESSAGE="${10}"
TARGET_DIRECTORY="${11}"
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
EXCLUDE_DIRECTORIES="${13}"
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
then
@ -119,7 +120,7 @@ mv "$TEMP_DIR/.git" "$CLONE_DIR/.git"
echo "[+] List contents of $SOURCE_DIRECTORY"
ls "$SOURCE_DIRECTORY"
rm -rf "$SOURCE_DIRECTORY/.git"
echo "[+] Checking if local $SOURCE_DIRECTORY exist"
if [ ! -d "$SOURCE_DIRECTORY" ]
then
@ -140,6 +141,7 @@ cp -ra "$SOURCE_DIRECTORY"/. "$CLONE_DIR/$TARGET_DIRECTORY"
cd "$CLONE_DIR"
echo "[+] Files that will be pushed"
chown -R $(id -u):$(id -g) .
ls -la
ORIGIN_COMMIT="https://$GITHUB_SERVER/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
@ -162,7 +164,12 @@ fi
echo "[+] Adding git commit"
git add .
if [ -n "$EXCLUDE_DIRECTORIES" ]
then
echo "[+] Checkout excluded dirs"
git reset -- $(echo $EXCLUDE_DIRECTORIES)
git restore $(echo $EXCLUDE_DIRECTORIES)
fi
echo "[+] git status:"
git status