-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'github/basic' into basic
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
# Target repository URL (replace this with the target repository URL) | ||
TARGET_REPO="[email protected]:Tengs-Penkwe/FarmDSL.git" | ||
|
||
# Check if we're already in the process of pushing to the target repo | ||
if [ "$PUSHING_TO_TARGET" = "true" ]; then | ||
# echo "Already pushing to target repository. Skipping to avoid loop." | ||
exit 0 | ||
else | ||
echo "\nAlso pushing to the GitHub repo to use the CI tools it provides\n" | ||
fi | ||
|
||
# Get the name of the current branch | ||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
# Set an environment variable to prevent recursive triggering | ||
export PUSHING_TO_TARGET=true | ||
|
||
# Push the current branch to the same branch in the target repository | ||
git push "$TARGET_REPO" "$CURRENT_BRANCH" -f | ||
|
||
# Unset the environment variable after the push | ||
unset PUSHING_TO_TARGET | ||
|
||
# Check if the push was successful | ||
if [ $? -eq 0 ]; then | ||
echo "\nPush to GitHub repository succeeded.\n" | ||
else | ||
echo "\nPush to GitHub repository failed.\n" >&2 | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters