Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/copybara.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Copybara

on:
pull_request:
branches:
- main

jobs:
copybara:
name: Sync switchboard-sdk repo with sbv3 main branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Checkout as many commits as needed for the diff
fetch-depth: 2

- name: Set up credentials files
# put the ssh_key and access_token in files
run: |
echo "${{ secrets.COPYBARA_SSH_KEY }}" > $HOME/copybara_ssh_key
echo "https://user:${{ secrets.COPYBARA_PAT }}@github.com" > $HOME/copybara_pat

- name: Run Copybara
# run copybara and pass in the credentials files
run: |
docker run \
-v "$(pwd)":/usr/src/app \
-v $HOME/copybara_ssh_key:/root/.ssh/id_rsa \
-v $HOME/copybara_pat:/root/.git-credentials \
gesarki/copybara:1.0.0 copy.bara.sky default ${{ github.event.number }} --force --init-history --git-committer-email "[email protected]" --git-committer-name "Github Actions"
59 changes: 59 additions & 0 deletions copy.bara.sky
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This config file is used for syncing changes in sbv3 with the switchboard-sdk mirror repo.

sbv3RepoUrl = "https://github.com/switchboard-xyz/sbv3.git"
switchboardSdkRepoUrl = "https://github.com/switchboard-xyz/switchboard-sdk"

# switchboard-sdk -> sbv3 monorepo PR
core.workflow(
name = "default",
origin = git.github_pr_origin(
url = switchboardSdkRepoUrl,
),

destination = git.github_pr_destination(
url = sbv3RepoUrl,
destination_ref = 'main',
title = '🫶 Contributor PR from switchboard-sdk: ${GITHUB_PR_TITLE}',
body = '''
Copied from ${GITHUB_PR_URL}.
> [!NOTE]
> Please don't reply to this PR as the original contributor won't be able to view it. Instead, reply on the switchboard-sdk PR linked above. This PR will be automatically synced with the original one.

Original PR body follows:

---
${GITHUB_PR_BODY}
---

> [!IMPORTANT]
> 👉 Make sure you undo the `workspace`->`latest` changes in `package.json` files.
> 👉 Once you merge this PR into sbv3 the changes will be automatically copied over to [switchboard-sdk](https://github.com/switchboard-xyz/switchboard-sdk/).
> 👉 Don't forget to close the original PR afterwards!
'''
),
origin_files = glob([
"solana/**"
]),
# Only affect files under these paths in the destination
destination_files = glob([
"javascript/on-demand/**",
"rust/switchboard-on-demand/**",
"rust/switchboard-on-demand-client/**"
]),
transformations = [
## move the solana SDKs to their original paths
core.move(
before = "solana/javascript/on-demand",
after = "javascript/on-demand"
),
core.move(
before = "solana/rust/switchboard-on-demand",
after = "rust/switchboard-on-demand"
),
core.move(
before = "solana/rust/switchboard-on-demand-client",
after = "rust/switchboard-on-demand-client"
)
],
authoring = authoring.pass_thru("Copybara <[email protected]>")
)
Loading