Skip to content

Commit d4fce08

Browse files
authored
meta(ci): Auto-add package label to new issues (#8623)
We can try to parse the used package from the issue body and auto-add the corresponding label.
1 parent 428598d commit d4fce08

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ body:
3232
options:
3333
- '@sentry/browser'
3434
- '@sentry/angular'
35+
- '@sentry/angular-ivy'
3536
- '@sentry/ember'
3637
- '@sentry/gatsby'
3738
- '@sentry/nextjs'

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 💡 Feature Request
22
description: Create a feature request for a sentry-javascript SDK.
3-
labels: 'Type: Improvement'
3+
labels: ['Type: Improvement']
44
body:
55
- type: markdown
66
attributes:
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: 'Tag issue with package label'
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
add_labels:
9+
name: Add package label
10+
runs-on: ubuntu-latest
11+
if: ${{ !github.event.issue.pull_request }}
12+
steps:
13+
- name: Get used package from issue body
14+
# https://github.com/actions-ecosystem/action-regex-match
15+
uses: actions-ecosystem/action-regex-match@v2
16+
id: packageName
17+
with:
18+
# Parse used package from issue body
19+
text: ${{ github.event.issue.body }}
20+
regex: '### Which SDK are you using\?\n\n(.*)\n\n'
21+
22+
- name: Map package to issue label
23+
# https://github.com/kanga333/variable-mapper
24+
uses: kanga333/[email protected]
25+
id: packageLabel
26+
if: steps.packageName.outputs.match != ''
27+
with:
28+
key: ${{ steps.packageName.outputs.group1 }}
29+
map: |
30+
{
31+
"@sentry/browser": {
32+
"label": "Package: Browser"
33+
},
34+
"@sentry/angular": {
35+
"label": "Package: Angular"
36+
},
37+
"@sentry/angular-ivy": {
38+
"label": "Package: Angular"
39+
},
40+
"@sentry/ember": {
41+
"label": "Package: ember"
42+
},
43+
"@sentry/gatsby": {
44+
"label": "Package: gatbsy"
45+
},
46+
"@sentry/nextjs": {
47+
"label": "Package: Nextjs"
48+
},
49+
"@sentry/node": {
50+
"label": "Package: Node"
51+
},
52+
"@sentry/opentelemetry-node": {
53+
"label": "Package: otel-node"
54+
},
55+
"@sentry/react": {
56+
"label": "Package: react"
57+
},
58+
"@sentry/remix": {
59+
"label": "Package: remix"
60+
},
61+
"@sentry/serverless": {
62+
"label": "Package: Serverless"
63+
},
64+
"@sentry/svelte": {
65+
"label": "Package: svelte"
66+
},
67+
"@sentry/sveltekit": {
68+
"label": "Package: SvelteKit"
69+
},
70+
"@sentry/vue": {
71+
"label": "Package: vue"
72+
},
73+
"@sentry/wasm": {
74+
"label": "Package: wasm"
75+
},
76+
"Sentry Browser Loader": {
77+
"label": "Package-Meta: Loader"
78+
},
79+
"Sentry Browser CDN bundle": {
80+
"label": "Package-Meta: CDN"
81+
}
82+
}
83+
export_to: output
84+
85+
- name: Add package label if applicable
86+
# Note: We only add the label if the issue is still open
87+
if: steps.packageLabel.outputs.label != ''
88+
uses: actions-ecosystem/action-add-labels@v1
89+
with:
90+
labels: ${{ steps.packageLabel.outputs.label }}

0 commit comments

Comments
 (0)