Skip to content

Commit 7b8a011

Browse files
committed
chore: Modified bug issue template to add checkbox to report potential regression.
1 parent 4e31351 commit 7b8a011

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ body:
1212
description: What is the problem? A clear and concise description of the bug.
1313
validations:
1414
required: true
15+
- type: checkboxes
16+
id: regression
17+
attributes:
18+
label: Regression Issue
19+
description: What is a regression? If it worked in a previous version but doesn't in the latest version, it's considered a regression. In this case, please provide specific version number in the report.
20+
options:
21+
- label: Select this option if this issue appears to be a regression.
22+
required: false
1523
- type: textarea
1624
id: expected
1725
attributes:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Apply potential regression label on issues
2+
name: issue-regression-label
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
permissions: read-all
7+
jobs:
8+
add-regression-label:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
steps:
13+
- name: Fetch template body
14+
id: check_regression
15+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
TEMPLATE_BODY: ${{ github.event.issue.body }}
19+
with:
20+
script: |
21+
const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i;
22+
const template = `${process.env.TEMPLATE_BODY}`
23+
const match = regressionPattern.test(template);
24+
core.setOutput('is_regression', match);
25+
- name: Manage regression label
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
30+
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
31+
else
32+
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}
33+
fi

0 commit comments

Comments
 (0)