Skip to content

Commit 8b93fe2

Browse files
Added auto labeler workflow
1 parent 86dc84c commit 8b93fe2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 🏷️ Auto-label by Component
2+
on:
3+
issues:
4+
types: [opened, edited]
5+
6+
jobs:
7+
label-by-component:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Extract component and apply label
11+
uses: actions/github-script@v7
12+
with:
13+
script: |
14+
const componentField = context.payload.issue.body.match(/### Which component is this issue related to\?\n\n(.+)/);
15+
if (!componentField) return;
16+
17+
const componentMap = {
18+
"Umbraco Commerce (Core)": "component/commerce",
19+
"Payment Provider": "component/payment-provider",
20+
"Shipping Provider": "component/shipping-provider",
21+
"Sales Tax Provider": "component/sales-tax-provider",
22+
"Deploy": "component/deploy",
23+
"Checkout": "component/checkout",
24+
"Cart": "component/cart",
25+
"Demo Store": "component/demo",
26+
"Other / Not sure": "component/other"
27+
};
28+
29+
const selected = componentField[1].trim();
30+
const label = componentMap[selected];
31+
if (label) {
32+
await github.rest.issues.addLabels({
33+
issue_number: context.issue.number,
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
labels: [label]
37+
});
38+
}

0 commit comments

Comments
 (0)