mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2024-12-22 08:06:10 -07:00
Updates and avoids having the email hardcoded
This commit is contained in:
parent
38563e1748
commit
0f0c204dae
|
@ -10,6 +10,9 @@ inputs:
|
|||
destination-repository-name:
|
||||
description: 'Destination repository'
|
||||
required: true
|
||||
user-email:
|
||||
description: 'Email for the git commit'
|
||||
required: true
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
|
@ -17,3 +20,4 @@ runs:
|
|||
- ${{ inputs.source-directory }}
|
||||
- ${{ inputs.destination-github-username }}
|
||||
- ${{ inputs.destination-repository-name }}
|
||||
- ${{ inputs.git-user-email }}
|
||||
|
|
|
@ -4,32 +4,21 @@ echo "Starts"
|
|||
FOLDER="$1"
|
||||
GITHUB_USERNAME="$2"
|
||||
GITHUB_REPO="$3"
|
||||
GIT_USER_EMAIL="$4"
|
||||
|
||||
CLONE_DIR="clone_repo"
|
||||
|
||||
git config --global user.email "carles@pina.cat"
|
||||
# Setup git
|
||||
git config --global user.email "$GIT_USER_EMAIL"
|
||||
git config --global user.name "$GITHUB_USERNAME"
|
||||
|
||||
git clone "https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
|
||||
|
||||
ls -l
|
||||
|
||||
# Copy files into the git and deletes all git
|
||||
cd "$CLONE_DIR"
|
||||
# find needs to be in the git repository directory
|
||||
find . | grep -v ".git" | grep -v "^\.*$" | xargs rm -rf # delete all files (to handle deletions)
|
||||
|
||||
cp -r "../$FOLDER"/* .
|
||||
|
||||
echo "After cd $CLONE_DIR"
|
||||
|
||||
ls -la
|
||||
|
||||
git add .
|
||||
git commit --message "Update from $GITHUB_REPOSITORY"
|
||||
git push origin master
|
||||
|
||||
cd ..
|
||||
echo "Done!"
|
||||
|
||||
|
||||
echo "Ends"
|
||||
|
|
Loading…
Reference in New Issue
Block a user