Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/basic' into basic
Browse files Browse the repository at this point in the history
  • Loading branch information
Tengs Penkwe committed Feb 2, 2024
2 parents 1443b7e + 56b9c8d commit 5f8c953
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .githooks/pre-push
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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"typescript": "^4.9.4"
},
"scripts": {
"postinstall": "git config core.hooksPath .githooks",
"cover": "nyc --reporter text --reporter html yarn run test",
"build": "tsc && yarn lint",
"lint": "eslint src --ext .ts",
Expand Down

0 comments on commit 5f8c953

Please sign in to comment.