Skip to content

Commit e347663

Browse files
committed
chore: update dependencies and package configurations
- Updated @modelcontextprotocol/sdk to version 1.27.1 in package-lock.json - Updated express to version 5.2.1 and express-rate-limit to version 8.2.1 - Updated other dependencies including ajv, minimatch, and others to their latest versions - Added overrides for @modelcontextprotocol/sdk in package.json to ensure compatibility - Modified SettingsPage component to set loading state before disabling 2FA
1 parent 12719ef commit e347663

File tree

4 files changed

+388
-53
lines changed

4 files changed

+388
-53
lines changed
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: Auto PR Description
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
auto-describe:
9+
name: Auto Generate PR Description
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Generate PR Description
22+
uses: actions/github-script@v7
23+
with:
24+
script: |
25+
const pr = context.payload.pull_request;
26+
27+
// Skip if PR already has a detailed description (>100 chars)
28+
if (pr.body && pr.body.length > 100) {
29+
console.log('PR already has a description, skipping...');
30+
return;
31+
}
32+
33+
// Get commits
34+
const { data: commits } = await github.rest.pulls.listCommits({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
pull_number: pr.number
38+
});
39+
40+
// Get changed files
41+
const { data: files } = await github.rest.pulls.listFiles({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
pull_number: pr.number
45+
});
46+
47+
// Analyze commits
48+
const commitMessages = commits.map(c => c.commit.message);
49+
const uniqueMessages = [...new Set(commitMessages.filter(m =>
50+
!m.toLowerCase().includes('merge') &&
51+
!m.toLowerCase().startsWith('wip')
52+
))];
53+
54+
// Categorize changes
55+
const categories = {
56+
features: [],
57+
fixes: [],
58+
docs: [],
59+
refactor: [],
60+
tests: [],
61+
chore: [],
62+
other: []
63+
};
64+
65+
uniqueMessages.forEach(msg => {
66+
const lower = msg.toLowerCase();
67+
if (lower.startsWith('feat') || lower.includes('add') || lower.includes('implement')) {
68+
categories.features.push(msg);
69+
} else if (lower.startsWith('fix') || lower.includes('bug') || lower.includes('resolve')) {
70+
categories.fixes.push(msg);
71+
} else if (lower.startsWith('docs') || lower.includes('documentation')) {
72+
categories.docs.push(msg);
73+
} else if (lower.startsWith('refactor') || lower.includes('cleanup') || lower.includes('improve')) {
74+
categories.refactor.push(msg);
75+
} else if (lower.startsWith('test') || lower.includes('testing')) {
76+
categories.tests.push(msg);
77+
} else if (lower.startsWith('chore') || lower.includes('update dep')) {
78+
categories.chore.push(msg);
79+
} else {
80+
categories.other.push(msg);
81+
}
82+
});
83+
84+
// Analyze file changes
85+
const fileCategories = {
86+
backend: files.filter(f => f.filename.includes('convex/')),
87+
frontend: files.filter(f => f.filename.includes('src/app/') || f.filename.includes('src/components/')),
88+
auth: files.filter(f => f.filename.includes('auth')),
89+
config: files.filter(f => f.filename.match(/\.(json|yml|yaml|config|env)$/)),
90+
tests: files.filter(f => f.filename.includes('test') || f.filename.includes('spec')),
91+
docs: files.filter(f => f.filename.match(/\.(md|txt)$/))
92+
};
93+
94+
// Determine PR type
95+
let prType = 'chore';
96+
let typeEmoji = '🔧';
97+
98+
if (categories.features.length > 0) {
99+
prType = 'feat';
100+
typeEmoji = '✨';
101+
} else if (categories.fixes.length > 0) {
102+
prType = 'fix';
103+
typeEmoji = '🐛';
104+
} else if (categories.docs.length > 0) {
105+
prType = 'docs';
106+
typeEmoji = '📝';
107+
} else if (categories.refactor.length > 0) {
108+
prType = 'refactor';
109+
typeEmoji = '♻️';
110+
} else if (categories.tests.length > 0) {
111+
prType = 'test';
112+
typeEmoji = '✅';
113+
}
114+
115+
// Generate title if generic
116+
let newTitle = pr.title;
117+
const genericTitles = ['update', 'changes', 'patch', 'pr', 'merge'];
118+
const isGeneric = genericTitles.some(t => pr.title.toLowerCase().includes(t));
119+
120+
if (isGeneric || pr.title.length < 10) {
121+
// Try to create better title from commits
122+
const mainCommit = uniqueMessages[0] || 'Code changes';
123+
const cleanTitle = mainCommit
124+
.replace(/^(feat|fix|docs|refactor|test|chore)(\(.*?\))?:\s*/i, '')
125+
.trim();
126+
newTitle = `${prType}: ${cleanTitle}`;
127+
}
128+
129+
// Generate description
130+
let description = '## 📝 Description\n\n';
131+
132+
// Summary
133+
const totalChanges = files.reduce((sum, f) => sum + f.changes, 0);
134+
const areas = Object.entries(fileCategories)
135+
.filter(([_, f]) => f.length > 0)
136+
.map(([name, _]) => name);
137+
138+
description += `This PR introduces changes to ${areas.join(', ')} with ${files.length} files modified (${totalChanges} lines changed).\n\n`;
139+
140+
// Main changes
141+
description += '## 🔄 Changes Made\n\n';
142+
143+
for (const [category, messages] of Object.entries(categories)) {
144+
if (messages.length > 0) {
145+
const categoryName = category.charAt(0).toUpperCase() + category.slice(1);
146+
description += `### ${categoryName}\n`;
147+
messages.forEach(msg => {
148+
const cleaned = msg.replace(/^(feat|fix|docs|refactor|test|chore)(\(.*?\))?:\s*/i, '').trim();
149+
description += `- ${cleaned}\n`;
150+
});
151+
description += '\n';
152+
}
153+
}
154+
155+
// File changes breakdown
156+
description += '## 📁 Files Changed\n\n';
157+
for (const [category, categoryFiles] of Object.entries(fileCategories)) {
158+
if (categoryFiles.length > 0) {
159+
const categoryName = category.charAt(0).toUpperCase() + category.slice(1);
160+
description += `**${categoryName}** (${categoryFiles.length} files)\n`;
161+
}
162+
}
163+
164+
// Type of change
165+
description += '\n## 🏷️ Type of Change\n\n';
166+
description += `- [${prType === 'fix' ? 'x' : ' '}] Bug fix\n`;
167+
description += `- [${prType === 'feat' ? 'x' : ' '}] New feature\n`;
168+
description += `- [${prType === 'docs' ? 'x' : ' '}] Documentation update\n`;
169+
description += `- [${prType === 'refactor' ? 'x' : ' '}] Code refactoring\n`;
170+
description += `- [${prType === 'test' ? 'x' : ' '}] Test addition or update\n`;
171+
description += `- [ ] Breaking change\n`;
172+
173+
// Testing
174+
description += '\n## ✅ Testing Done\n\n';
175+
description += '- [ ] Tested locally in development environment\n';
176+
description += '- [ ] Added unit tests\n';
177+
description += '- [ ] Verified in production-like environment\n';
178+
179+
// Additional sections
180+
description += '\n## 📷 Screenshots / Videos\n\n';
181+
description += '_Add screenshots or videos if applicable_\n\n';
182+
183+
description += '## 📚 Additional Notes\n\n';
184+
description += '_Add any additional context or notes for reviewers_\n\n';
185+
186+
description += '---\n';
187+
description += `\n_🤖 This description was auto-generated from ${commits.length} commit(s). Please review and update as needed._`;
188+
189+
// Update PR
190+
await github.rest.pulls.update({
191+
owner: context.repo.owner,
192+
repo: context.repo.repo,
193+
pull_number: pr.number,
194+
title: newTitle,
195+
body: description
196+
});
197+
198+
console.log(`✅ Updated PR #${pr.number}`);
199+
console.log(`Title: ${newTitle}`);
200+
console.log(`Type: ${prType} ${typeEmoji}`);
201+
202+
- name: Add Comment
203+
uses: actions/github-script@v7
204+
with:
205+
script: |
206+
await github.rest.issues.createComment({
207+
owner: context.repo.owner,
208+
repo: context.repo.repo,
209+
issue_number: context.payload.pull_request.number,
210+
body: '🤖 **Auto-generated PR description has been added!**\n\n' +
211+
'The title and description were generated based on your commits and file changes.\n' +
212+
'Please review and update:\n' +
213+
'- ✏️ Edit the description to add more context if needed\n' +
214+
'- 🔗 Link related issues using `Closes #123`\n' +
215+
'- ✅ Check the boxes for type of change and testing done\n' +
216+
'- 📷 Add screenshots/videos if UI changes were made\n\n' +
217+
'See our [Contributing Guidelines](../CONTRIBUTING.md) for best practices.'
218+
});

0 commit comments

Comments
 (0)