From ce7f9d3bbf9643c0bb39f45fb8c03ef23143cc89 Mon Sep 17 00:00:00 2001 From: jhan0121 Date: Tue, 24 Feb 2026 19:00:11 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=BD=94=EB=93=9C=20=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20actions=20=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/code-review.yml | 78 +++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/code-review.yml diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml new file mode 100644 index 0000000..d1d50e7 --- /dev/null +++ b/.github/workflows/code-review.yml @@ -0,0 +1,78 @@ +name: "Claude Code Review" +on: + pull_request: + types: [ opened, reopened, synchronize ] +jobs: + review: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Delete Previous Claude Reviews + if: github.event.action == 'synchronize' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set +e # Continue on error + PR_NUMBER=${{ github.event.pull_request.number }} + REPO=${{ github.repository }} + echo "๐Ÿ” ์ด์ „ Claude ๋ฆฌ๋ทฐ ๊ฒ€์ƒ‰ ์ค‘..." + # 1. PR ์ฝ”๋ฉ˜ํŠธ(์š”์•ฝ) ์‚ญ์ œ - github-actions[bot]์ด ์ž‘์„ฑํ•œ ์ฝ”๋ฉ˜ํŠธ + gh api "repos/$REPO/issues/$PR_NUMBER/comments" \ + --jq '.[] | select(.user.login == "github-actions[bot]") | .id' \ + | while read comment_id; do + if [ -n "$comment_id" ]; then + echo "๐Ÿ—‘๏ธ PR ์ฝ”๋ฉ˜ํŠธ ์‚ญ์ œ: $comment_id" + gh api -X DELETE "repos/$REPO/issues/comments/$comment_id" 2>/dev/null || echo "โš ๏ธ ์‚ญ์ œ ์‹คํŒจ (๋ฌด์‹œ)" + sleep 0.3 + fi + done + # 2. ์ธ๋ผ์ธ ๋ฆฌ๋ทฐ ์ฝ”๋ฉ˜ํŠธ ์‚ญ์ œ + # - ๋ฏธํ•ด๊ฒฐ ์Šค๋ ˆ๋“œ ์ค‘ bot ์ฝ”๋ฉ˜ํŠธ๋งŒ ์žˆ๋Š” ์Šค๋ ˆ๋“œ๋งŒ ์‚ญ์ œ + # - ์‚ฌ์šฉ์ž ๋‹ต๊ธ€์ด ์žˆ๋Š” ์Šค๋ ˆ๋“œ๋Š” ์‚ญ์ œํ•˜์ง€ ์•Š์Œ (์ฝ”๋“œ๋งŒ ๋ฉ๊ทธ๋Ÿฌ๋‹ˆ ๋‚จ๋Š” ๋ฌธ์ œ ๋ฐฉ์ง€) + OWNER=${REPO%/*} + NAME=${REPO#*/} + gh api graphql -F owner="$OWNER" -F name="$NAME" -F number=$PR_NUMBER -f query=' + query($owner: String!, $name: String!, $number: Int!) { + repository(owner: $owner, name: $name) { + pullRequest(number: $number) { + reviewThreads(last: 100) { + nodes { + isResolved + comments(first: 50) { + nodes { + databaseId + author { + login + } + } + } + } + } + } + } + }' \ + --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | select([.comments.nodes[].author.login] | all(. == "github-actions")) | .comments.nodes[].databaseId' \ + | while read comment_id; do + if [ -n "$comment_id" ]; then + echo "๐Ÿ—‘๏ธ ์ธ๋ผ์ธ ์ฝ”๋ฉ˜ํŠธ ์‚ญ์ œ: $comment_id" + gh api -X DELETE "repos/$REPO/pulls/comments/$comment_id" 2>/dev/null || echo "โš ๏ธ ์‚ญ์ œ ์‹คํŒจ (๋ฌด์‹œ)" + sleep 0.3 + fi + done + echo "โœ… ์ด์ „ ๋ฆฌ๋ทฐ ์‚ญ์ œ ์™„๋ฃŒ" + - name: Run Claude Code Review + uses: anthropics/claude-code-action@v1 + with: + show_full_output: true + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + ์ด PR์„ ๋ฆฌ๋ทฐํ•˜๊ณ  ์ฝ”๋ฉ˜ํŠธ๋กœ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”. + claude_args: | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"