Skip to content

Commit 2a6b2b0

Browse files
authored
Merge pull request #2 from switchboard-xyz/alternative-main
copybara workflow
2 parents bf2b070 + 2ca36dd commit 2a6b2b0

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

.github/workflows/copybara.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Copybara
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
copybara:
10+
name: Sync switchboard-sdk repo with sbv3 main branch
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
# Checkout as many commits as needed for the diff
17+
fetch-depth: 2
18+
19+
- name: Set up credentials files
20+
# put the ssh_key and access_token in files
21+
run: |
22+
echo "${{ secrets.COPYBARA_SSH_KEY }}" > $HOME/copybara_ssh_key
23+
echo "https://user:${{ secrets.COPYBARA_PAT }}@github.com" > $HOME/copybara_pat
24+
25+
- name: Run Copybara
26+
# run copybara and pass in the credentials files
27+
run: |
28+
docker run \
29+
-v "$(pwd)":/usr/src/app \
30+
-v $HOME/copybara_ssh_key:/root/.ssh/id_rsa \
31+
-v $HOME/copybara_pat:/root/.git-credentials \
32+
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"

copy.bara.sky

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This config file is used for syncing changes in sbv3 with the switchboard-sdk mirror repo.
2+
3+
sbv3RepoUrl = "https://github.com/switchboard-xyz/sbv3.git"
4+
switchboardSdkRepoUrl = "https://github.com/switchboard-xyz/switchboard-sdk"
5+
6+
# switchboard-sdk -> sbv3 monorepo PR
7+
core.workflow(
8+
name = "default",
9+
origin = git.github_pr_origin(
10+
url = switchboardSdkRepoUrl,
11+
),
12+
13+
destination = git.github_pr_destination(
14+
url = sbv3RepoUrl,
15+
destination_ref = 'main',
16+
title = '🫶 Contributor PR from switchboard-sdk: ${GITHUB_PR_TITLE}',
17+
body = '''
18+
Copied from ${GITHUB_PR_URL}.
19+
> [!NOTE]
20+
> 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.
21+
22+
Original PR body follows:
23+
24+
---
25+
${GITHUB_PR_BODY}
26+
---
27+
28+
> [!IMPORTANT]
29+
> 👉 Make sure you undo the `workspace`->`latest` changes in `package.json` files.
30+
> 👉 Once you merge this PR into sbv3 the changes will be automatically copied over to [switchboard-sdk](https://github.com/switchboard-xyz/switchboard-sdk/).
31+
> 👉 Don't forget to close the original PR afterwards!
32+
'''
33+
),
34+
origin_files = glob([
35+
"solana/**"
36+
]),
37+
# Only affect files under these paths in the destination
38+
destination_files = glob([
39+
"javascript/on-demand/**",
40+
"rust/switchboard-on-demand/**",
41+
"rust/switchboard-on-demand-client/**"
42+
]),
43+
transformations = [
44+
## move the solana SDKs to their original paths
45+
core.move(
46+
before = "solana/javascript/on-demand",
47+
after = "javascript/on-demand"
48+
),
49+
core.move(
50+
before = "solana/rust/switchboard-on-demand",
51+
after = "rust/switchboard-on-demand"
52+
),
53+
core.move(
54+
before = "solana/rust/switchboard-on-demand-client",
55+
after = "rust/switchboard-on-demand-client"
56+
)
57+
],
58+
authoring = authoring.pass_thru("Copybara <[email protected]>")
59+
)

0 commit comments

Comments
 (0)