Skip to content

Sync Forks

Sync Forks #1

Workflow file for this run

name: Sync Forks
on:
schedule:
- cron: "0 10 * * *"
workflow_dispatch:
inputs:
repo:
description: "Repo to sync (empty = all)"
required: false
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Sync forks
env:
GH_TOKEN: ${{ secrets.ORG_PAT }}
run: |
set -euo pipefail
if [ -n "${{ inputs.repo }}" ]; then
repos="ton-python/${{ inputs.repo }}"
else
repos=$(gh repo list ton-python \
--fork --no-archived --limit 100 \
--json nameWithOwner -q '.[].nameWithOwner')
fi
if [ -z "$repos" ]; then
echo "No forks found"
exit 0
fi
failed=0
while read -r repo; do
echo "Syncing $repo ..."
if ! gh repo sync "$repo" --force 2>&1; then
echo "::warning::Failed to sync $repo"
failed=1
fi
done <<< "$repos"
if [ "$failed" -eq 1 ]; then
echo "::error::Some repos failed to sync"
exit 1
fi