diff --git a/.github/workflows/copybara-sync.yaml b/.github/workflows/copybara-sync.yaml new file mode 100644 index 00000000..da8efe0d --- /dev/null +++ b/.github/workflows/copybara-sync.yaml @@ -0,0 +1,30 @@ +name: Copybara Sync to Monorepo + +on: + push: + branches: [main] + pull_request_target: + types: [opened, synchronize, reopened] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + # For PRs, checkout the PR head to sync the actual changes + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} + + - name: Sync to Monorepo + uses: olivr/copybara-action@v1.2.5 + with: + ssh_key: ${{ secrets.COPYBARA_SSH_KEY }} + access_token: ${{ secrets.MONOREPO_SYNC_TOKEN }} + sot_repo: OpenRouterTeam/typescript-sdk + destination_repo: OpenRouterTeam/openrouter-web + workflow: push + push_move: '||sdks/typescript||**' + push_exclude: '.github/workflows/copybara-sync.yaml' + # For PRs, create a PR in monorepo; for pushes to main, push directly + copybara_options: ${{ github.event_name == 'pull_request_target' && '--force' || '' }}