Skip to content

Commit 9f56263

Browse files
authored
Merge pull request #58 from manicinc/templates/tracked-work
chore(github): ask for the issue link, spec, pictures and docs in issues and pull requests
2 parents de86678 + 0b5f26e commit 9f56263

2 files changed

Lines changed: 31 additions & 18 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ Describe the change and why it is needed.
99
<!-- auto-summary-end -->
1010

1111
## 🔗 Related Issues
12-
Closes #
12+
13+
<!-- One line, outside this comment:
14+
Closes #n the pull request that finishes a tracked plan or fixes a reported problem
15+
Part of #n every earlier pull request of a tracked plan
16+
No issue a change that fits in one pull request (a fix, a review follow-up, a dependency bump, a docs edit)
17+
-->
18+
19+
## Spec, plan and design
20+
21+
<!-- Links to the spec, plan and design round this implements. In a public repository, public links only. Write "None" when there are none. -->
1322

1423
## 📝 Type of Change
1524
- [ ] ✨ Feature
@@ -36,6 +45,10 @@ Describe tests added/updated and manual verification steps.
3645
## 💥 Breaking Changes
3746
If breaking, describe impact and migration path.
3847

48+
## Pictures
49+
50+
<!-- Before and after pictures at phone and desktop width for anything a person sees, with secrets and personal data hidden. Write "No visible change" otherwise. -->
51+
3952
## 📸 Screenshots / Logs (optional)
4053

4154
## 📌 Additional Notes

‎.github/workflows/auto-pr-summary.yml‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,30 @@ jobs:
4242
// Fallback to PR title if nothing matched
4343
const changes = items.length ? items.join('\n') : `- ${pr.title}`;
4444
45-
const body = pr.body || '';
45+
// Read the body now, not from the event: a run that started before the author's
46+
// latest edit must not write its older copy back over that edit.
47+
const { data: current } = await github.rest.pulls.get({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
pull_number: pr.number,
51+
});
52+
const body = current.body || '';
4653
const start = '<!-- auto-summary-start -->';
4754
const end = '<!-- auto-summary-end -->';
4855
const summary = `\n## 🧾 Auto Summary\n${changes}\n`;
4956
5057
let newBody;
5158
if (body.includes(start) && body.includes(end)) {
52-
newBody = body.replace(new RegExp(`${start}[\s\S]*?${end}`), `${start}${summary}${end}`);
59+
newBody = body.replace(new RegExp(`${start}[\\s\\S]*?${end}`), () => `${start}${summary}${end}`);
5360
} else {
5461
newBody = `${body}\n${start}${summary}${end}`.trim();
5562
}
5663
57-
core.setOutput('body', newBody);
58-
- name: Update PR body
59-
uses: actions/github-script@v7
60-
with:
61-
script: |
62-
const pr = context.payload.pull_request;
63-
const body = process.env.BODY;
64-
await github.rest.pulls.update({
65-
owner: context.repo.owner,
66-
repo: context.repo.repo,
67-
pull_number: pr.number,
68-
body,
69-
});
70-
env:
71-
BODY: ${{ steps.build.outputs.body }}
64+
if (newBody !== body) {
65+
await github.rest.pulls.update({
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
pull_number: pr.number,
69+
body: newBody,
70+
});
71+
}

0 commit comments

Comments
 (0)