-
Notifications
You must be signed in to change notification settings - Fork 71
66 lines (64 loc) · 3 KB
/
Copy pathcopybara-pr.yaml
File metadata and controls
66 lines (64 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: copybara-pr
on:
pull_request:
branches: [main]
jobs:
copy:
if: ${{ github.repository == 'render-oss/render-mcp-server' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: oracle
java-version: 21
- name: Generate an app token for render-oss
id: generate-token-oss
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}
owner: render-oss
repositories: render-mcp-server
- name: Generate an app token for renderinc
id: generate-token-renderinc
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}
owner: renderinc
repositories: render-mcp-server
- name: Get GitHub App User ID
id: get-user-id
env:
GH_TOKEN: ${{ steps.generate-token-renderinc.outputs.token }}
APP_SLUG: ${{ steps.generate-token-renderinc.outputs.app-slug }}
run: echo "user-id=$(gh api "/users/$APP_SLUG[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Set up credentials
env:
RENDERINC_TOKEN: ${{ steps.generate-token-renderinc.outputs.token }}
RENDER_OSS_TOKEN: ${{ steps.generate-token-oss.outputs.token }}
APP_SLUG: ${{ steps.generate-token-oss.outputs.app-slug }}
USER_ID: ${{ steps.get-user-id.outputs.user-id }}
run: |
echo "https://$USER:$RENDERINC_TOKEN@api.github.com" > ~/.git-credentials
echo "https://$USER:$RENDERINC_TOKEN@github.com" >> ~/.git-credentials
git config --global user.name "$APP_SLUG[bot]"
git config --global user.email "$USER_ID+$APP_SLUG[bot]@users.noreply.github.com"
git config --global url."https://$USER:${RENDERINC_TOKEN}@github.com/renderinc".insteadOf "git@github.com:renderinc"
git config --global url."https://$USER:${RENDERINC_TOKEN}@github.com/renderinc".insteadOf "https://github.com/renderinc"
git config --global url."https://$USER:${RENDER_OSS_TOKEN}@github.com/render-oss".insteadOf "git@github.com:render-oss"
git config --global url."https://$USER:${RENDER_OSS_TOKEN}@github.com/render-oss".insteadOf "https://github.com/render-oss"
- name: Set up copybara
run: |
wget https://github.com/google/copybara/releases/download/v20251215/copybara_deploy.jar
java -jar copybara_deploy.jar version
java -jar copybara_deploy.jar validate copy.bara.sky
- name: Run workflow
env:
RENDERINC_TOKEN: ${{ steps.generate-token-renderinc.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
java -jar copybara_deploy.jar copy.bara.sky pr $PR_NUMBER \
--git-destination-url "https://$USER:$RENDERINC_TOKEN@github.com/renderinc/render-mcp-server.git"