From f4f7bd87a00d989fc117f008b064ead0fa0f8000 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 12:34:42 +0900 Subject: [PATCH 01/13] test: reviewer assignment test1 --- test.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.md diff --git a/test.md b/test.md new file mode 100644 index 0000000..6d0e25e --- /dev/null +++ b/test.md @@ -0,0 +1 @@ +test 중입니다. From 92031fcd4039cfa7ba1f7916361d4d2068c3a842 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 12:36:06 +0900 Subject: [PATCH 02/13] test: reviewer assignment test2 --- test.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test.md b/test.md index 6d0e25e..4617d4e 100644 --- a/test.md +++ b/test.md @@ -1 +1,2 @@ -test 중입니다. +test 1 +test 2 From 2fe396678145413da7f453944e5d50dd74be06d0 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 12:37:20 +0900 Subject: [PATCH 03/13] test: reviewer assignment test3 --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index 4617d4e..241483b 100644 --- a/test.md +++ b/test.md @@ -1,2 +1,3 @@ test 1 test 2 +test 3 From d21886cabd50d9175a7bacad984267a4a1f0075f Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 12:55:53 +0900 Subject: [PATCH 04/13] chore: separate reviewer assignment and discord pr notification --- .github/workflows/assign_reviewers.yml | 8 +-- .github/workflows/notifier_pr.yml | 68 ++++++++++++-------------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/.github/workflows/assign_reviewers.yml b/.github/workflows/assign_reviewers.yml index 7752dcd..75f5ee2 100644 --- a/.github/workflows/assign_reviewers.yml +++ b/.github/workflows/assign_reviewers.yml @@ -2,7 +2,7 @@ name: Assign Reviewers on: pull_request: - types: [opened, ready_for_review] + types: [opened] jobs: assign-reviewers: @@ -11,9 +11,9 @@ jobs: - name: checkout repository uses: actions/checkout@v4 - - name: assign Random Reviewers + - name: run assignment script uses: actions/github-script@v7 with: script: | - const script = require('./.github/scripts/assign-reviewers.js'); - await script({ github, context }); + const { default: run } = await import('${{ github.workspace }}/.github/scripts/assign_reviewers.js'); + await run({ github, context, core }); diff --git a/.github/workflows/notifier_pr.yml b/.github/workflows/notifier_pr.yml index 6fc7a0a..6b54b92 100644 --- a/.github/workflows/notifier_pr.yml +++ b/.github/workflows/notifier_pr.yml @@ -12,50 +12,42 @@ jobs: env: DISCORD_CHANNEL_ID: ${{secrets.DISCORD_CHANNEL_ID_PR}} BOT_TOKEN: ${{secrets.REMINDER_BOT_TOKEN}} - WORKSPACE_PATH: ${{ github.workspace }} permissions: - pull-requests: write + pull-requests: read contents: read steps: - - name: checkout repository - uses: actions/checkout@v4 - - - name: assign reviewers - id: assign - uses: actions/github-script@v7 - with: - script: | - const scriptPath = `${process.env.WORKSPACE_PATH}/.github/scripts/assign_reviewers.js`; - const { default: run } = await import(scriptPath); - await run({ github, context, core }); - - name: notify discord on PR created uses: actions/github-script@v7 - env: - SELECTED_REVIEWERS: ${{steps.assign.outputs.reviewers}} with: script: | - const discordPayload = { - embeds: [{ - title: "NEW PR", - description: "새로운 PR이 생성되었습니다. 코드 리뷰가 기다리고 있어요.", - color: 5815039, - fields: [ - { name: "제목", value: context.payload.pull_request.title, inline: false}, - { name: "작성자", value: context.payload.pull_request.user.login, inline: true }, - { name: "지정 리뷰어", value: process.env.SELECTED_REVIEWERS, inline: true }, - { name: "링크", value: `[바로가기](${context.payload.pull_request.html_url})`, inline: false }, - ] - }] - }; - - await fetch(`https://discord.com/api/v10/channels/${process.env.DISCORD_CHANNEL_ID}/messages`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bot ${process.env.BOT_TOKEN}` - }, - body: JSON.stringify(discordPayload) - }); + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + }); + + const reviewers = pr.requested_reviewers.map(r => `@${r.login}`).join(", "); + + const discordPayload = { + content: "새로운 PR이 생성되었습니다. 코드 리뷰가 기다리고 있어요.", + embeds: [{ + title: "NEW PR", + description: `[${pr.title}](${pr.html_url})`, + color: 5815039, + fields: [ + { name: "작성자", value: pr.user.login, inline: true }, + { name: "지정 리뷰어", value: reviewers || "지정 중...", inline: true }, + ] + }] + }; + + await fetch(`https://discord.com/api/v10/channels/${process.env.DISCORD_CHANNEL_ID}/messages`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bot ${process.env.BOT_TOKEN}` + }, + body: JSON.stringify(discordPayload) + }); From 0c5db06966b7f12e500d740eb6257d443ba2d972 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 12:56:47 +0900 Subject: [PATCH 05/13] test: reviewer assignment --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index 241483b..bfba1d5 100644 --- a/test.md +++ b/test.md @@ -1,3 +1,4 @@ test 1 test 2 test 3 +test From 68a58b749fa1865eea7efe8e888fd29b9d780b9c Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 12:55:53 +0900 Subject: [PATCH 06/13] chore: separate reviewer assignment and discord pr notification --- .github/workflows/assign_reviewers.yml | 12 +++-- .github/workflows/notifier_pr.yml | 68 ++++++++++++-------------- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/.github/workflows/assign_reviewers.yml b/.github/workflows/assign_reviewers.yml index 7752dcd..322b138 100644 --- a/.github/workflows/assign_reviewers.yml +++ b/.github/workflows/assign_reviewers.yml @@ -2,18 +2,22 @@ name: Assign Reviewers on: pull_request: - types: [opened, ready_for_review] + types: [opened] jobs: assign-reviewers: runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read + steps: - name: checkout repository uses: actions/checkout@v4 - - name: assign Random Reviewers + - name: run assignment script uses: actions/github-script@v7 with: script: | - const script = require('./.github/scripts/assign-reviewers.js'); - await script({ github, context }); + const { default: run } = await import('${{ github.workspace }}/.github/scripts/assign_reviewers.js'); + await run({ github, context, core }); diff --git a/.github/workflows/notifier_pr.yml b/.github/workflows/notifier_pr.yml index 6fc7a0a..6b54b92 100644 --- a/.github/workflows/notifier_pr.yml +++ b/.github/workflows/notifier_pr.yml @@ -12,50 +12,42 @@ jobs: env: DISCORD_CHANNEL_ID: ${{secrets.DISCORD_CHANNEL_ID_PR}} BOT_TOKEN: ${{secrets.REMINDER_BOT_TOKEN}} - WORKSPACE_PATH: ${{ github.workspace }} permissions: - pull-requests: write + pull-requests: read contents: read steps: - - name: checkout repository - uses: actions/checkout@v4 - - - name: assign reviewers - id: assign - uses: actions/github-script@v7 - with: - script: | - const scriptPath = `${process.env.WORKSPACE_PATH}/.github/scripts/assign_reviewers.js`; - const { default: run } = await import(scriptPath); - await run({ github, context, core }); - - name: notify discord on PR created uses: actions/github-script@v7 - env: - SELECTED_REVIEWERS: ${{steps.assign.outputs.reviewers}} with: script: | - const discordPayload = { - embeds: [{ - title: "NEW PR", - description: "새로운 PR이 생성되었습니다. 코드 리뷰가 기다리고 있어요.", - color: 5815039, - fields: [ - { name: "제목", value: context.payload.pull_request.title, inline: false}, - { name: "작성자", value: context.payload.pull_request.user.login, inline: true }, - { name: "지정 리뷰어", value: process.env.SELECTED_REVIEWERS, inline: true }, - { name: "링크", value: `[바로가기](${context.payload.pull_request.html_url})`, inline: false }, - ] - }] - }; - - await fetch(`https://discord.com/api/v10/channels/${process.env.DISCORD_CHANNEL_ID}/messages`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bot ${process.env.BOT_TOKEN}` - }, - body: JSON.stringify(discordPayload) - }); + const { data: pr } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + }); + + const reviewers = pr.requested_reviewers.map(r => `@${r.login}`).join(", "); + + const discordPayload = { + content: "새로운 PR이 생성되었습니다. 코드 리뷰가 기다리고 있어요.", + embeds: [{ + title: "NEW PR", + description: `[${pr.title}](${pr.html_url})`, + color: 5815039, + fields: [ + { name: "작성자", value: pr.user.login, inline: true }, + { name: "지정 리뷰어", value: reviewers || "지정 중...", inline: true }, + ] + }] + }; + + await fetch(`https://discord.com/api/v10/channels/${process.env.DISCORD_CHANNEL_ID}/messages`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bot ${process.env.BOT_TOKEN}` + }, + body: JSON.stringify(discordPayload) + }); From 713490bdd7a28bc19cdcf2642c4d96548ae581e9 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:01:22 +0900 Subject: [PATCH 07/13] test: assign reveiwer4 --- test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.md b/test.md index bfba1d5..731f52b 100644 --- a/test.md +++ b/test.md @@ -1,4 +1,4 @@ test 1 test 2 test 3 -test +test 4 From 70371bdd92d35122466efe468323f60ec70b3769 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:13:35 +0900 Subject: [PATCH 08/13] test: reviewer assignment5 --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index 731f52b..ef821da 100644 --- a/test.md +++ b/test.md @@ -2,3 +2,4 @@ test 1 test 2 test 3 test 4 +test 5 From 7abf258f9630c4dddea12026eebda805721dcb52 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:25:33 +0900 Subject: [PATCH 09/13] test: reviewer assignment7 --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index 3c393da..0391faa 100644 --- a/test.md +++ b/test.md @@ -4,3 +4,4 @@ test 3 test 4 test 5 test 6 +test 7 From 1b95afbe6faae348de676af013c031217ed43461 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:28:30 +0900 Subject: [PATCH 10/13] test: reviewer assignment7-1 --- test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.md b/test.md index 0391faa..be25277 100644 --- a/test.md +++ b/test.md @@ -4,4 +4,4 @@ test 3 test 4 test 5 test 6 -test 7 +test 7-1 From dd8b4290095e0c4c4a72034ad0d76c8df90dd124 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:47:16 +0900 Subject: [PATCH 11/13] test: reviewer assignment7-2 --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index be25277..a4fb939 100644 --- a/test.md +++ b/test.md @@ -5,3 +5,4 @@ test 4 test 5 test 6 test 7-1 +test 7-2 From 371b336bfab0bdc02b383430bf5e73752c1be65f Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:50:56 +0900 Subject: [PATCH 12/13] test: reviewer assignment8 --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index a4fb939..9476990 100644 --- a/test.md +++ b/test.md @@ -6,3 +6,4 @@ test 5 test 6 test 7-1 test 7-2 +test 8 From c008961a85fd99b89f3be0ff7bbd62c609aac966 Mon Sep 17 00:00:00 2001 From: Sienna Date: Sun, 15 Mar 2026 13:51:58 +0900 Subject: [PATCH 13/13] test: reviewer assignment8-1 --- test.md | 1 + 1 file changed, 1 insertion(+) diff --git a/test.md b/test.md index 9476990..48f657d 100644 --- a/test.md +++ b/test.md @@ -7,3 +7,4 @@ test 6 test 7-1 test 7-2 test 8 +test 8-1