github-action-push-to-anoth.../entrypoint.sh

36 lines
653 B
Bash
Raw Normal View History

2020-03-29 08:44:47 -06:00
#!/bin/sh -l
echo "Starts"
2020-03-29 09:07:19 -06:00
FOLDER="$1"
GITHUB_USERNAME="$2"
GITHUB_REPO="$3"
2020-03-29 09:13:00 -06:00
CLONE_DIR="clone_repo"
2020-03-29 09:07:19 -06:00
git config --global user.email "carles@pina.cat"
git config --global user.name "$GITHUB_USERNAME"
git clone "https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
ls -l
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"