[Added a script for auto syncing forks of parent repository] Beta #2
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m45s
sample gradle build and test / tag (push) Successful in 6s
sample gradle build and test / build_tag_push (push) Successful in 2m21s
sample gradle build and test / Sync All Forks (push) Successful in 8s
All checks were successful
sample gradle build and test / build (pull_request) Successful in 1m45s
sample gradle build and test / tag (push) Successful in 6s
sample gradle build and test / build_tag_push (push) Successful in 2m21s
sample gradle build and test / Sync All Forks (push) Successful in 8s
This commit is contained in:
parent
665361a4e3
commit
ef7b6545db
@ -84,34 +84,15 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Sync all forks via Gitea API
|
- name: Sync all forks via Gitea API
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.TOKEN }}
|
|
||||||
BASE_URL: "https://gitea.hithomelabs.com/api/v1"
|
|
||||||
OWNER: "Hithomelabs"
|
|
||||||
REPO: "CFTunnels"
|
|
||||||
run: |
|
run: |
|
||||||
set -e
|
echo "Fetching forks for Hithomelabs/CFTunnels..."
|
||||||
set -o pipefail
|
response=$(curl -s -X GET "https://gitea.hithomelabs.com/api/v1/repos/Hithomelabs/CFTunnels/forks" -H "Authorization: token ${{secrets.TOKEN}}")
|
||||||
|
filtered=$(echo "$response" | grep -o '"clone_url":"[^"]*"' | sed 's/"clone_url":"\([^"]*\)"/\1/' | grep -v "/Hithomelabs")
|
||||||
echo "Fetching forks for $OWNER/$REPO..."
|
|
||||||
response=$(curl -s -X GET "$BASE_URL/repos/$OWNER/$REPO/forks" -H "Authorization: token $TOKEN")
|
|
||||||
|
|
||||||
# Extract clone URLs of forked repos (excluding the parent repo)
|
|
||||||
filtered=$(echo "$response" | grep -o '"clone_url":"[^"]*"' | sed 's/"clone_url":"\([^"]*\)"/\1/' | grep -v "/$OWNER")
|
|
||||||
|
|
||||||
echo "Detected forks:"
|
echo "Detected forks:"
|
||||||
echo "$filtered"
|
echo "$filtered"
|
||||||
|
|
||||||
readarray -t forks <<< "$filtered"
|
readarray -t forks <<< "$filtered"
|
||||||
|
|
||||||
for fork_url in "${forks[@]}"; do
|
for fork_url in "${forks[@]}"; do
|
||||||
echo "🔄 Syncing fork: $fork_url"
|
echo "🔄 Syncing fork: $fork_url"
|
||||||
git remote add fork "$fork_url" 2>/dev/null || git remote set-url fork "$fork_url"
|
git push "$fork_url" test &
|
||||||
if git push fork main --force >/dev/null 2>&1; then
|
|
||||||
echo "✅ Synced $fork_url successfully"
|
|
||||||
else
|
|
||||||
echo "❌ Failed to sync $fork_url"
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user