Skip to content

Commit dd1fbc5

Browse files
authored
chore: add PR and issue templates (asispts#22)
1 parent 3095c36 commit dd1fbc5

5 files changed

Lines changed: 138 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @asispts
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug or unexpected behavior
4+
labels: bug
5+
---
6+
7+
**Describe the bug**
8+
9+
<!-- A clear and concise description of what the bug is -->
10+
11+
**Steps to reproduce**
12+
13+
1.
14+
2.
15+
3.
16+
17+
**Expected behavior**
18+
19+
<!-- What you expected to happen -->
20+
21+
**Actual behavior**
22+
23+
<!-- What actually happened -->
24+
25+
**Screenshots**
26+
27+
<!-- If applicable, add screenshots to help explain the problem -->
28+
29+
**Environment**
30+
31+
- VS Code version:
32+
- Extension version:
33+
- OS:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature or enhancement
4+
labels: enhancement
5+
---
6+
7+
**Describe the feature**
8+
9+
<!-- A clear and concise description of what you want -->
10+
11+
**Problem it solves**
12+
13+
<!-- What problem or limitation does this address? -->
14+
15+
**Proposed solution**
16+
17+
<!-- How would you like it to work? -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| Q | A |
2+
| ----- | ----------- |
3+
| Type | feature/fix |
4+
| Issue | Fix #... |
5+
6+
<!-- Describe what this PR does -->

.github/workflows/pr-labeler.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: PR Labeler
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, edited]
6+
pull_request_review:
7+
types: [submitted]
8+
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
label-type:
15+
runs-on: ubuntu-latest
16+
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'edited')
17+
steps:
18+
- name: Apply type label
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const body = context.payload.pull_request.body || '';
23+
const match = body.match(/\|\s*Type\s*\|\s*(feature|fix)\s*\|/i);
24+
if (!match) return;
25+
26+
const type = match[1].toLowerCase();
27+
const label = type === 'fix' ? 'bug' : 'enhancement';
28+
const prNumber = context.payload.pull_request.number;
29+
30+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: prNumber,
34+
});
35+
36+
const toRemove = ['bug', 'enhancement'].filter(l => labels.some(e => e.name === l) && l !== label);
37+
for (const l of toRemove) {
38+
await github.rest.issues.removeLabel({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
issue_number: prNumber,
42+
name: l,
43+
}).catch(() => {});
44+
}
45+
46+
await github.rest.issues.addLabels({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
issue_number: prNumber,
50+
labels: [label],
51+
});
52+
53+
label-status-add:
54+
runs-on: ubuntu-latest
55+
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')
56+
steps:
57+
- name: 'Add "status: needs review"'
58+
uses: actions/github-script@v7
59+
with:
60+
script: |
61+
await github.rest.issues.addLabels({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
issue_number: context.payload.pull_request.number,
65+
labels: ['status: needs review'],
66+
});
67+
68+
label-status-remove:
69+
runs-on: ubuntu-latest
70+
if: github.event_name == 'pull_request_review' && github.event.review.state == 'approved'
71+
steps:
72+
- name: 'Remove "status: needs review" on approval'
73+
uses: actions/github-script@v7
74+
with:
75+
script: |
76+
await github.rest.issues.removeLabel({
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
issue_number: context.payload.pull_request.number,
80+
name: 'status: needs review',
81+
}).catch(() => {});

0 commit comments

Comments
 (0)