Skip to content

Commit 8b5fb90

Browse files
leaanthonyclaude
andcommitted
šŸ¤– Complete PR comment enhancement with author tagging and collapsible changelog
- Added PR author detection and tagging in comments - Implemented collapsible details section showing corrected changelog content - Enhanced error messages with clear action items for users - Better distinction between auto-fixed and manual-fix-required scenarios - Complete changelog content display for easy copying šŸ¤– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3f92510 commit 8b5fb90

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

ā€Ž.github/workflows/changelog-v3.yml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,61 @@ jobs:
151151
env:
152152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153153

154+
- name: Get PR author for tagging
155+
id: pr_author
156+
if: steps.validate.outputs.result && github.event.inputs.pr_number
157+
run: |
158+
PR_AUTHOR=$(gh pr view ${{ steps.pr_info.outputs.pr_number }} --json author --jq '.author.login')
159+
echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT
160+
env:
161+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162+
154163
- name: Comment on PR
155164
if: steps.validate.outputs.result && github.event.inputs.pr_number
156165
uses: actions/github-script@v7
157166
with:
158167
script: |
159168
const result = '${{ steps.validate.outputs.result }}';
160169
const committed = '${{ steps.commit_fixes.outputs.committed }}';
170+
const author = '${{ steps.pr_author.outputs.author }}';
161171
162172
let message;
163173
if (result === 'success') {
164174
message = '## āœ… Changelog Validation Passed\n\nNo misplaced changelog entries detected.';
165175
} else if (result === 'fixed' && committed === 'true') {
166176
message = '## šŸ”§ Changelog Updated\n\nMisplaced entries were automatically moved to the `[Unreleased]` section. The changes have been committed to this PR.';
167-
} else if (result === 'cannot_fix' || result === 'error') {
168-
message = '## āŒ Changelog Validation Failed\n\nPlease manually move changelog entries to the `[Unreleased]` section.';
177+
} else if (result === 'fixed' || result === 'cannot_fix' || result === 'error') {
178+
// Read the fixed changelog content
179+
const fs = require('fs');
180+
let fixedContent = '';
181+
try {
182+
fixedContent = fs.readFileSync('docs/src/content/docs/changelog.mdx', 'utf8');
183+
} catch (error) {
184+
fixedContent = 'Error reading fixed changelog content';
185+
}
186+
187+
message = `## āš ļø Changelog Validation Issue
188+
189+
@${author} Your PR contains changelog entries that were added to already-released versions. These need to be moved to the \`[Unreleased]\` section.
190+
191+
${committed === 'true' ?
192+
'āœ… **Auto-fix applied**: The changes have been automatically committed to this PR.' :
193+
'āŒ **Manual fix required**: Please apply the changes shown below manually.'
194+
}
195+
196+
<details>
197+
<summary>šŸ“ Click to see the corrected changelog content</summary>
198+
199+
\`\`\`mdx
200+
${fixedContent}
201+
\`\`\`
202+
203+
</details>
204+
205+
**What happened?**
206+
The validation script detected that you added changelog entries to a version section that has already been released (like \`v3.0.0-alpha.10\`). All new entries should go in the \`[Unreleased]\` section under the appropriate category (\`### Added\`, \`### Fixed\`, etc.).
207+
208+
${committed !== 'true' ? '**Action needed:** Please copy the corrected content from above and replace your changelog file.' : ''}`;
169209
}
170210

171211
if (message) {

0 commit comments

Comments
Ā (0)