-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (73 loc) · 3.93 KB
/
claude.yml
File metadata and controls
80 lines (73 loc) · 3.93 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
76
77
78
79
80
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: write # Claude가 PR 브랜치에 커밋 푸시할 수 있도록 write
pull-requests: write # Claude가 PR 코멘트/리뷰를 작성할 수 있도록 write
issues: write # Claude가 이슈 코멘트를 작성할 수 있도록 write
id-token: write
actions: read # Claude가 PR의 CI 결과를 읽을 수 있도록 필요
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
# claude-code-action은 working dir의 .mcp.json을 enableAllProjectMcpServers로 자동 로드한다.
# repo에 .mcp.json을 두지 않고(로컬 환경 침범 방지) 워크플로우 실행 중에만 생성하여 Notion MCP를 등록.
# claude_args의 --mcp-config는 v1에서 무시되는 정황이 확인되어 자동 로드 경로를 사용.
- name: Generate .mcp.json for Notion MCP
run: |
cat > .mcp.json <<'JSON'
{
"mcpServers": {
"notion": {
"command": "npx",
"args": ["-y", "@notionhq/notion-mcp-server"]
}
}
}
JSON
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
env:
# Notion MCP 서버(@notionhq/notion-mcp-server)가 OpenAPI 호출 시 사용할 인증 헤더.
# npx 자식 프로세스가 step env를 자동 상속하므로 MCP config 파일에는 별도로 명시하지 않음.
# 토큰은 "스터디 플랫폼 : 코드 제로투원" 페이지에 connection된 integration의 권한 범위 내에서만 동작.
OPENAPI_MCP_HEADERS: '{"Authorization":"Bearer ${{ secrets.NOTION_TOKEN }}","Notion-Version":"2022-06-28"}'
# @notionhq/notion-mcp-server가 NOTION_TOKEN을 직접 읽는 케이스 fallback.
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# 자동 로드된 mcp__notion__*가 LLM에 노출되도록 + 프론트엔드 패키지 매니저 명령어 허용
claude_args: '--allowedTools "mcp__notion__*,Bash(npm *),Bash(yarn *),Bash(pnpm *),Bash(npx *),Edit,Write,Read,Glob,Grep,LS"'
# Claude 응답 완료 시 프론트엔드 Slack 채널에 알림. 성공/실패 모두 통지하여 쿼터 소진 등 에러 상황도 추적 가능하게 함.
- name: Notify Slack on Claude response
if: always()
uses: slackapi/slack-github-action@v2.1.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_FRONT_CHANNEL_ID }}
text: "Claude가 응답했습니다 (${{ steps.claude.outcome }})\n- 위치: <${{ github.event.issue.pull_request.html_url || github.event.issue.html_url || github.event.pull_request.html_url }}|보러 가기>\n- 호출자: ${{ github.event.comment.user.login || github.event.review.user.login || github.event.issue.user.login }}"
unfurl_links: false
unfurl_media: false