name: Sync README links section on: push: # paths: # - 'README.md' # branches: # - master workflow_dispatch: # Allows manual triggering concurrency: group: 'docs' cancel-in-progress: true jobs: sync-docs: runs-on: ubuntu-latest strategy: matrix: repository: [ 'phosphor-icons/core', 'phosphor-icons/figma', 'phosphor-icons/flutter', 'phosphor-icons/penpot', 'phosphor-icons/phosphor-elm', # 'phosphor-icons/play', # 'phosphor-icons/react', # 'phosphor-icons/sketch', # 'phosphor-icons/swift', # 'phosphor-icons/theme', # 'phosphor-icons/unplugin', # 'phosphor-icons/vue', # 'phosphor-icons/web', # 'phosphor-icons/webcomponents' ] steps: - name: Checkout uses: actions/checkout@v4 with: path: source-repo - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9 run_install: false - name: Install Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' cache-dependency-path: source-repo/pnpm-lock.yaml - name: Install dependencies working-directory: source-repo run: pnpm install - name: Sync to target repositories env: GITHUB_TOKEN: ${{ secrets.SYNC_PAT }} run: | echo "Syncing to ${{ matrix.repository }}" # Clone target repository using HTTPS with token git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ matrix.repository }}.git" target-repo # Run sync script cd source-repo pnpm run sync-docs -- target-repo cd .. # Create PR if there are changes cd target-repo if [[ -n "$(git status --porcelain)" ]]; then git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" # Create branch BRANCH="sync-readme-$(date +%Y%m%d-%H%M%S)" git checkout -b $BRANCH # Commit and push changes git add README.md git commit -m "chore(docs): sync readme section" git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ matrix.repository }}.git" $BRANCH # Create PR using the GitHub CLI gh pr create \ --repo "${{ matrix.repository }}" \ --title "chore(docs): sync readme section" \ --body "Automated PR to sync README section from master repository" \ --base $(git remote show origin | sed -n '/HEAD branch/s/.*: //p') \ --head $BRANCH fi