-
Notifications
You must be signed in to change notification settings - Fork 3
75 lines (60 loc) · 2.45 KB
/
sync-to-frontend.yml
File metadata and controls
75 lines (60 loc) · 2.45 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
67
68
69
70
71
72
73
74
75
name: Sync from Bruno
on:
repository_dispatch:
types: [bruno_updated]
env:
BRUNO_REPO_URL: ${{ vars.BRUNO_REPO_URL || format('https://github.com/{0}/api-docs.git', github.repository_owner) }}
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Clone Bruno Repo
run: |
rm -rf /tmp/bruno
BRANCH="${{ github.event.client_payload.branch || 'main' }}"
REPO_PATH="${BRUNO_REPO_URL#https://github.com/}"
if [ "$REPO_PATH" = "$BRUNO_REPO_URL" ]; then
echo "BRUNO_REPO_URL must start with https://github.com/: $BRUNO_REPO_URL"
exit 1
fi
echo "Cloning Bruno repo from branch: $BRANCH"
echo "Bruno source repo: $BRUNO_REPO_URL"
git clone -b "$BRANCH" "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${REPO_PATH}" /tmp/bruno
- name: Clone bruno-api-typescript
run: |
rm -rf /tmp/bruno-api-typescript
git clone https://github.com/solid-connection/bruno-api-typescript.git /tmp/bruno-api-typescript
- uses: actions/setup-node@v4
with:
node-version: "18"
- name: Build bruno-api-typescript
working-directory: /tmp/bruno-api-typescript
run: |
npm install
npm run build
- name: Generate Hooks
run: |
node /tmp/bruno-api-typescript/dist/cli/index.js generate-hooks -i /tmp/bruno -o ./apps/web/src/apis
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: "chore: sync API from Bruno"
branch: api-sync-${{ github.run_number }}
title: "🔄 API Sync from Bruno"
body: |
## Bruno API 자동 동기화
Bruno 저장소가 업데이트되어 자동으로 hooks를 생성했습니다.
**소스 브랜치**: `${{ github.event.client_payload.branch || 'main' }}`
**커밋 SHA**: `${{ github.event.client_payload.sha || 'N/A' }}`
**변경사항**:
- React Query hooks 업데이트
- TypeScript 타입 업데이트