Skip to content

[FE][Feat] ์‚ฌ์šฉ์ž ๋งˆ์ปค ๋ฐ ํŒจ์Šค ์œ„๋กœ ์˜ฌ๋ฆผ, ๋ฐฉํ–ฅ ์ˆ˜์ • #322

[FE][Feat] ์‚ฌ์šฉ์ž ๋งˆ์ปค ๋ฐ ํŒจ์Šค ์œ„๋กœ ์˜ฌ๋ฆผ, ๋ฐฉํ–ฅ ์ˆ˜์ •

[FE][Feat] ์‚ฌ์šฉ์ž ๋งˆ์ปค ๋ฐ ํŒจ์Šค ์œ„๋กœ ์˜ฌ๋ฆผ, ๋ฐฉํ–ฅ ์ˆ˜์ • #322

name: 'Auto Assign Reviewers'
on:
pull_request:
types: [opened]
jobs:
assign_reviewers:
runs-on: ubuntu-latest
steps:
- name: 'Set Assignee to Author'
uses: actions/github-script@v6
with:
script: |
if (context.payload.pull_request) {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
assignees: [context.payload.pull_request.user.login],
});
} else {
console.log('No pull_request data found in context.payload');
}
- name: 'Add "ํ™•์ธ ์š”์ฒญ" Label if not present'
uses: actions/github-script@v6
with:
script: |
const labels = context.payload.pull_request.labels || [];
if (!labels.some(label => label.name === 'ํ™•์ธ ์š”์ฒญ')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['ํ™•์ธ ์š”์ฒญ'],
});
}
- name: 'Determine Number of Reviewers'
id: determine_reviewers
uses: actions/github-script@v6
with:
script: |
const targetBranch = context.payload.pull_request.base.ref;
const reviewers = (targetBranch === 'main' || targetBranch === 'development') ? 3 : 2;
return { number_of_reviewers: reviewers };
- name: 'Assign Reviewers'
uses: kentaro-m/[email protected]
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
configuration-path: '.github/auto_assign_config.yml'
numberOfReviewers: ${{ steps.determine_reviewers.outputs.number_of_reviewers }}