Merge branch 'lineofflight:main' into main #4
This file contains hidden or 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
| name: Sync Forks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| sync-forks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Discover and sync forks | |
| env: | |
| GH_TOKEN: ${{ secrets.ORG_PAT }} | |
| run: | | |
| REPO="${{ github.repository }}" | |
| OWNER="${REPO%/*}" | |
| BASE_REPO="${REPO#*/}" | |
| FORKS=$(gh api repos/$OWNER/$BASE_REPO/forks --paginate | | |
| jq -r ".[] | select(.owner.login == \"$OWNER\") | | |
| .name") | |
| echo "$FORKS" | while read -r fork; do | |
| if [ -n "$fork" ]; then | |
| echo "Syncing fork: $OWNER/$fork" | |
| gh repo sync $OWNER/$fork --source $OWNER/$BASE_REPO || echo "Failed to sync $OWNER/$fork" | |
| fi | |
| done |