mirror of
https://github.com/morpheusthewhite/spicetify-themes.git
synced 2024-11-22 02:42:54 +01:00
feat: custom assigning workflow (#1028)
This commit is contained in:
parent
fa0e9cfea3
commit
27cafff801
100
.github/workflows/auto-assign.yml
vendored
100
.github/workflows/auto-assign.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: 'Auto Assing on Theme'
|
||||
name: Theme Assigner
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
@ -9,62 +9,46 @@ jobs:
|
||||
assign:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: Naturalclar/issue-action@v2.0.2
|
||||
- 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.match(new RegExp(`\\b${keyword}\\b`, "i")) || body.match(new RegExp(`\\b${keyword}\\b`, "i"))) {
|
||||
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,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user