mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-03 15:35:45 -06:00
Extended functionality to additional repos
This commit is contained in:
parent
5d8dc0fe1a
commit
3f3ed70656
28
action.yml
28
action.yml
@ -1,34 +1,38 @@
|
|||||||
name: 'Push directory to another repository'
|
name: "Push directory to another repository"
|
||||||
description: 'Useful to push files to another repository to be used, for example, via github pages'
|
description: "Useful to push files to another repository to be used, for example, via github pages"
|
||||||
inputs:
|
inputs:
|
||||||
source-directory:
|
source-directory:
|
||||||
description: 'Source directory from the origin directory'
|
description: "Source directory from the origin directory"
|
||||||
required: true
|
required: true
|
||||||
|
additional-repos:
|
||||||
|
description: "Any additional repos for the final commit"
|
||||||
|
required: false
|
||||||
destination-github-username:
|
destination-github-username:
|
||||||
description: 'Name of the destination username/organization'
|
description: "Name of the destination username/organization"
|
||||||
required: true
|
required: true
|
||||||
destination-repository-name:
|
destination-repository-name:
|
||||||
description: 'Destination repository'
|
description: "Destination repository"
|
||||||
required: true
|
required: true
|
||||||
user-email:
|
user-email:
|
||||||
description: 'Email for the git commit'
|
description: "Email for the git commit"
|
||||||
required: true
|
required: true
|
||||||
destination-repository-username:
|
destination-repository-username:
|
||||||
description: '[Optional] Username/organization for the destination repository'
|
description: "[Optional] Username/organization for the destination repository"
|
||||||
required: false
|
required: false
|
||||||
target-branch:
|
target-branch:
|
||||||
description: '[Optional] set target branch name for the destination repository'
|
description: "[Optional] set target branch name for the destination repository"
|
||||||
required: false
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: "docker"
|
||||||
image: 'Dockerfile'
|
image: "Dockerfile"
|
||||||
args:
|
args:
|
||||||
- ${{ inputs.source-directory }}
|
- ${{ inputs.source-directory }}
|
||||||
|
- ${{ inputs.additional-repos }}
|
||||||
- ${{ inputs.destination-github-username }}
|
- ${{ inputs.destination-github-username }}
|
||||||
- ${{ inputs.destination-repository-name }}
|
- ${{ inputs.destination-repository-name }}
|
||||||
- ${{ inputs.user-email }}
|
- ${{ inputs.user-email }}
|
||||||
- ${{ inputs.destination-repository-username }}
|
- ${{ inputs.destination-repository-username }}
|
||||||
- ${{ inputs.target-branch }}
|
- ${{ inputs.target-branch }}
|
||||||
branding:
|
branding:
|
||||||
icon: 'git-commit'
|
icon: "git-commit"
|
||||||
color: 'green'
|
color: "green"
|
||||||
|
@ -7,6 +7,7 @@ GITHUB_REPO="$3"
|
|||||||
USER_EMAIL="$4"
|
USER_EMAIL="$4"
|
||||||
REPO_USERNAME="$5"
|
REPO_USERNAME="$5"
|
||||||
TARGET_BRANCH="$6"
|
TARGET_BRANCH="$6"
|
||||||
|
ADDITIONAL_REPOS="$7"
|
||||||
|
|
||||||
if [ -z "$REPO_USERNAME" ]
|
if [ -z "$REPO_USERNAME" ]
|
||||||
then
|
then
|
||||||
@ -26,6 +27,9 @@ git config --global user.name "$GITHUB_USERNAME"
|
|||||||
git clone --single-branch --branch "$TARGET_BRANCH" "https://$API_TOKEN_GITHUB@github.com/$REPO_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
git clone --single-branch --branch "$TARGET_BRANCH" "https://$API_TOKEN_GITHUB@github.com/$REPO_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
||||||
ls -la "$CLONE_DIR"
|
ls -la "$CLONE_DIR"
|
||||||
|
|
||||||
|
echo "Cloning additional repositories"
|
||||||
|
git clone --single-branch --branch "master" "https://$API_TOKEN_GITHUB@github.com/$REPO_USERNAME/$ADDITIONAL_REPOS.git" "$CLONE_DIR/projects"
|
||||||
|
|
||||||
echo "Cleaning destination repository of old files"
|
echo "Cleaning destination repository of old files"
|
||||||
# Copy files into the git and deletes all git
|
# Copy files into the git and deletes all git
|
||||||
find "$CLONE_DIR" | grep -v "^$CLONE_DIR/\.git" | grep -v "^$CLONE_DIR$" | xargs rm -rf # delete all files (to handle deletions)
|
find "$CLONE_DIR" | grep -v "^$CLONE_DIR/\.git" | grep -v "^$CLONE_DIR$" | xargs rm -rf # delete all files (to handle deletions)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user