Skip to content

Commit

Permalink
feat: use our own assigning workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsojramos committed Dec 19, 2023
1 parent fa0e9cf commit 361283c
Showing 1 changed file with 46 additions and 58 deletions.
104 changes: 46 additions & 58 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Auto Assing on Theme'
name: Theme Assigner
on:
issues:
types: [opened, edited]
Expand All @@ -9,62 +9,50 @@ jobs:
assign:
runs-on: ubuntu-latest
steps:
- uses: Naturalclar/[email protected]
- uses: actions/github-script@v7
with:
title-or-body: 'both'
parameters: |
[
{
"keywords": ["BurntSienna"],
"assignees": ["pjaspinski"]
},
{
"keywords": ["Default"],
"assignees": ["Blacksuan19"]
},
{
"keywords": ["Dreary"],
"assignees": ["CharlieS1103"]
},
{
"keywords": ["Dribbblish"],
"assignees": ["harbassan"]
},
{
"keywords": ["Glaze"],
"assignees": ["CharlieS1103"]
},
{
"keywords": ["Onepunch"],
"assignees": ["okarin001"]
},
{
"keywords": ["Sleek"],
"assignees": ["harbassan"]
},
{
"keywords": ["Turntable"],
"assignees": ["grasonchan"]
},
{
"keywords": ["Ziro"],
"assignees": ["schnensch0"]
},
{
"keywords": ["Flow"],
"assignees": ["ian-Liaozy", "Ruixi-Zhang"]
},
{
"keywords": ["Matte"],
"assignees": ["darkthemer"]
},
{
"keywords": ["Blossom"],
"assignees": ["Robatortas"]
},
{
"keywords": ["Nightlight"],
"assignees": ["iTenerai"]
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const keywordsToAssigneesMap = {
BurntSienna: ["pjaspinski"],
Default: ["Blacksuan19"],
Dreary: ["CharlieS1103"],
Dribbblish: ["khanhas"],
Glaze: ["CharlieS1103"],
Onepunch: ["okarin001"],
Sleek: ["harbassan"],
Turntable: ["grasonchan"],
Ziro: ["schnensch0"],
Flow: ["ian-Liaozy", "Ruixi-Zhang"],
Matte: ["darkthemer"],
Blossom: ["Robatortas"],
Nightlight: ["iTenerai"],
};
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const title = issue.data.title;
const body = issue.data.body;
const assignees = [];
for (const [keyword, assignee] of Object.entries(keywordsToAssigneesMap)) {
if (title.includes(keyword) || body.includes(keyword)) {
if (Array.isArray(assignee)) {
assignees.push(...assignee);
} else {
assignees.push(assignee);
}
}
]
github-token: '${{ secrets.GITHUB_TOKEN }}'
}
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: assignees,
});

0 comments on commit 361283c

Please sign in to comment.