Skip to content

Commit 24ce5db

Browse files
committed
Better PR titles and commit messages
1 parent 3531f34 commit 24ce5db

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

.github/workflows/claude-fix-issue.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,33 @@ jobs:
137137
138138
## Step 4: Write a summary
139139
140-
After completing the fix, write two files:
140+
After completing the fix, write three files:
141141
142-
1. /tmp/commit-message.txt - A concise commit message (first line: short summary under 72 chars, then a blank line, then a few bullet points describing key changes). Example:
143-
Fix array_key_exists narrowing for template types
142+
1. /tmp/pr-title.txt - A single-line PR title that describes **what the change does**, not what it fixes. Write it as a precise, technical description of the actual code change you made.
144143
145-
- Added handling for TemplateType in TypeSpecifier when processing array_key_exists
146-
- New regression test in tests/PHPStan/Analyser/nsrt/bug-12345.php
147-
- The root cause was that TypeSpecifier did not unwrap template bounds before narrowing
144+
Style rules:
145+
- Use imperative voice describing the action taken in the source code (e.g. "Report ...", "Do not ...", "Use ... instead of ...", "Narrow ... when ...")
146+
- Be specific about classes, methods, or PHP constructs involved — use backticks for code identifiers (e.g. `??`, `IntersectionTypeMethodReflection`, `TemplateType`)
147+
- Describe the mechanism of the fix, not the symptom or the issue
148+
- Do NOT start with "Fix", "Bug:", "Issue:", or reference issue numbers
149+
- Do NOT just restate the issue title
150+
- Keep it under ~120 characters but do not sacrifice precision for brevity
148151
149-
2. /tmp/pr-description.md - A pull request description in this format:
152+
Good examples (study these carefully — match this style):
153+
- "Report promoted readonly or hooked non-nullable properties on the left side of \`??\`"
154+
- "Do not subtract TemplateType from TemplateType"
155+
- "IntersectionTypeMethodReflection: select method with most parameters instead of first one to query information"
156+
- "Narrow array key type after \`array_key_exists\` on intersection types"
157+
- "Preserve list type when assigning to existing offset"
158+
159+
Bad examples (do NOT write titles like these):
160+
- "Fix phpstan/phpstan#14459: Null coalescing operator does not report redundant left operand when always defined" (restates issue, mentions issue number)
161+
- "Fix bug with generics" (vague, not technical)
162+
- "Two unbounded generics in conditional return are assumed to be always the same" (describes symptom, not fix)
163+
164+
2. /tmp/commit-message.txt - A concise commit message. The first line MUST be identical to the contents of /tmp/pr-title.txt. Then a blank line, then a few bullet points describing the key changes (what code was changed and why, in technical terms).
165+
166+
3. /tmp/pr-description.md - A pull request description in this format:
150167
## Summary
151168
Brief description of what the issue was about and what the fix does.
152169
@@ -162,15 +179,23 @@ jobs:
162179
163180
Fixes phpstan/phpstan#${{ inputs.issue-number }}
164181
165-
These files are critical - they will be used for the commit message and PR description.
182+
These files are critical - they will be used for the PR title, commit message, and PR description. The PR title and commit subject line must describe **what the change does**, not what it fixes.
166183
PROMPT_EOF
167184
)"
168185
169186
- name: "Read Claude's summary"
170187
id: claude-summary
171188
env:
172189
ISSUE_NUMBER: ${{ inputs.issue-number }}
190+
ISSUE_TITLE: ${{ steps.issue.outputs.title }}
173191
run: |
192+
if [ -f /tmp/pr-title.txt ]; then
193+
PR_TITLE=$(head -n 1 /tmp/pr-title.txt)
194+
echo "pr_title=$PR_TITLE" >> "$GITHUB_OUTPUT"
195+
else
196+
echo "pr_title=Fix phpstan/phpstan#$ISSUE_NUMBER: $ISSUE_TITLE" >> "$GITHUB_OUTPUT"
197+
fi
198+
174199
if [ -f /tmp/commit-message.txt ]; then
175200
delimiter="EOF_$(openssl rand -hex 16)"
176201
{
@@ -202,7 +227,7 @@ jobs:
202227
push-to-fork: phpstan-bot/phpstan-src
203228
branch-suffix: random
204229
delete-branch: true
205-
title: "Fix phpstan/phpstan#${{ inputs.issue-number }}: ${{ steps.issue.outputs.title }}"
230+
title: ${{ steps.claude-summary.outputs.pr_title }}
206231
body: ${{ steps.claude-summary.outputs.pr_body }}
207232
committer: "phpstan-bot <ondrej+phpstanbot@mirtes.cz>"
208233
commit-message: ${{ steps.claude-summary.outputs.commit_message }}

0 commit comments

Comments
 (0)