Skip to content

Commit 87a0efc

Browse files
authored
Improve PR description template (temporalio#7706)
## What changed? Removed useless sections. Improved others. Changed HTML comments to _italic_ placeholders. Added GHA to validate placeholder removal (not blocking for now). ## Why? Team agreement. ## How did you test it? - [ ] built - [x] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
1 parent 4149888 commit 87a0efc

File tree

2 files changed

+67
-11
lines changed

2 files changed

+67
-11
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
## What changed?
2-
<!-- Describe what has changed in this PR -->
2+
_Describe what has changed in this PR._
33

44
## Why?
5-
<!-- Tell your future self why have you made these changes -->
5+
_Tell your future self why have you made these changes._
66

77
## How did you test it?
8-
<!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? -->
8+
- [ ] built
9+
- [ ] run locally and tested manually
10+
- [ ] covered by existing tests
11+
- [ ] added new unit test(s)
12+
- [ ] added new functional test(s)
913

1014
## Potential risks
11-
<!-- Assuming the worst case, what can be broken when deploying this change to production? -->
12-
13-
## Documentation
14-
<!-- Have you made sure this change doesn't falsify anything currently stated in `docs/`? If significant
15-
new behavior is added, have you described that in `docs/`? -->
16-
17-
## Is hotfix candidate?
18-
<!-- Is this PR a hotfix candidate or does it require a notification to be sent to the broader community? (Yes/No) -->
15+
_Any change is risky. Identify all risks you are aware of. If none, remove this section._
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Validate PR description for placeholder lines or empty sections
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
jobs:
11+
validate-pr-description:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Validate PR description for placeholder lines or empty sections
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const pr = await github.rest.pulls.get({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
pull_number: context.payload.pull_request.number
23+
});
24+
25+
const body = pr.data.body || '';
26+
const lines = body.split(/\r?\n/);
27+
28+
let violations = [];
29+
30+
// Detect placeholder lines: entire line starts and ends with _
31+
lines.forEach((line, idx) => {
32+
if (/^_.*_$/.test(line.trim())) {
33+
violations.push(`Line ${idx + 1}: Placeholder "${line.trim()}"`);
34+
}
35+
});
36+
37+
// Detect empty sections: look for headers like '## Why?' followed by no meaningful content
38+
const requiredSections = ['## What changed?', '## Why?', '## How did you test it?'];
39+
requiredSections.forEach((header) => {
40+
const idx = lines.findIndex(line => line.trim().toLowerCase() === header.toLowerCase());
41+
if (idx !== -1) {
42+
let contentIdx = idx + 1;
43+
while (contentIdx < lines.length && lines[contentIdx].trim() === '') {
44+
contentIdx++;
45+
}
46+
const nextLine = lines[contentIdx]?.trim();
47+
if (!nextLine || /^## /.test(nextLine)) {
48+
violations.push(`Section "${header}" appears to be empty.`);
49+
}
50+
}
51+
});
52+
53+
if (violations.length > 0) {
54+
console.log("❌ PR description issues found:");
55+
violations.forEach(v => console.log(`- ${v}`));
56+
core.setFailed(`PR description must not contain placeholders or empty sections.`);
57+
} else {
58+
console.log("✅ PR description passed all checks.");
59+
}

0 commit comments

Comments
 (0)