Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/contributor-recognition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ jobs:

let message = '';
if (isFirstTime) {
message = `🎉 Congratulations @${author} on your first merged contribution to Gravity-Lang!

This is a significant milestone, and we're grateful for your contribution. We hope this is the first of many!

🌟 You're now officially part of the Gravity-Lang community. Thank you for helping make this project better!`;
message = `🎉 Congratulations @${author} on your first merged contribution to Gravity-Lang!\n\nThis is a significant milestone, and we're grateful for your contribution. We hope this is the first of many!\n\n🌟 You're now officially part of the Gravity-Lang community. Thank you for helping make this project better!`;
} else {
message = `✨ Thank you @${author} for your contribution to Gravity-Lang!

Your work in PR #${prNumber} has been merged and will be part of the next release. We appreciate your continued support! 🚀`;
message = `✨ Thank you @${author} for your contribution to Gravity-Lang!\n\nYour work in PR #${prNumber} has been merged and will be part of the next release. We appreciate your continued support! 🚀`;
}

await github.rest.issues.createComment({
Expand Down Expand Up @@ -119,7 +113,7 @@ Your work in PR #${prNumber} has been merged and will be part of the next releas
const labels = issue.labels.map(l => l.name);

// Only thank for issues that were actually resolved/helpful
if (labels.includes('bug') || labels.includes('enhancement') || labels.includes('good first issue')) {
if (labels.includes('bug') || labels.includes('enhancement') || labels.includes('good-first-issue')) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
72 changes: 58 additions & 14 deletions .github/workflows/pr-auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,75 @@ jobs:

// Add version label to PR
const versionLabel = `version:${bumpType}`;
try {
// Remove old version labels before adding new one
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number
});
const oldVersionLabels = currentLabels
.map(l => l.name)
.filter(n => n.startsWith('version:') && n !== versionLabel);
for (const old of oldVersionLabels) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: old
});
}
} catch (e) {
console.log('Could not clean old version labels:', e.message);
}
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: [versionLabel]
});

// Add comment with version info
// Add / update version impact comment
const versionEmoji = bumpType === 'major' ? '🚨' : bumpType === 'minor' ? '✨' : '🔧';

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: `${versionEmoji} **Version Impact**
const majorNote = bumpType === 'major' ? '⚠️ This is a **breaking change** - major version will be incremented.' : '';
const minorNote = bumpType === 'minor' ? '🎉 This adds new features - minor version will be incremented.' : '';
const patchNote = bumpType === 'patch' ? '🐛 This is a fix or minor improvement - patch version will be incremented.' : '';

This PR will result in a **${bumpType}** version bump:
- Current version: \`${latestTag}\`
- Next version (if merged): \`${nextVersion}\`
const MARKER = '<!-- pr-auto-tag-bot -->';
const commentBody = MARKER + '\n' + `${versionEmoji} **Version Impact**\n\nThis PR will result in a **${bumpType}** version bump:\n- Current version: \`${latestTag}\`\n- Next version (if merged): \`${nextVersion}\`\n\n${majorNote}${minorNote}${patchNote}`;

${bumpType === 'major' ? '⚠️ This is a **breaking change** - major version will be incremented.' : ''}
${bumpType === 'minor' ? '🎉 This adds new features - minor version will be incremented.' : ''}
${bumpType === 'patch' ? '🐛 This is a fix or minor improvement - patch version will be incremented.' : ''}
`
});
let existing = null;
let page = 1;
while (!existing) {
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
per_page: 100,
page: page
});
if (comments.length === 0) break;
existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER)) || null;
if (comments.length < 100) break;
page++;
}

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: commentBody
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: commentBody
});
}

return {
current: latestTag,
Expand Down
59 changes: 34 additions & 25 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,9 @@ jobs:
const hasIssues = allIssues.length > 0;
const hasWarnings = allWarnings.length > 0;

let commentBody = '';
if (!hasIssues && !hasWarnings) {
// PR follows guidelines - add a positive comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: `✅ **PR Guidelines Validation Passed**

This PR follows all required contributing guidelines! Thank you for following best practices.

📖 See [CONTRIBUTING.md](../CONTRIBUTING.md) for more information.`
});
commentBody = '✅ **PR Guidelines Validation Passed**\n\nThis PR follows all required contributing guidelines! Thank you for following best practices.\n\n📖 See [CONTRIBUTING.md](../CONTRIBUTING.md) for more information.';
} else {
// Generate detailed report
let report = `## 📋 PR Guidelines Validation Report\n\n`;
Expand Down Expand Up @@ -274,12 +265,42 @@ This PR follows all required contributing guidelines! Thank you for following be
report += `---\n\n`;
report += `**Status**: ⚠️ All required checks passed, but consider the recommendations above.\n`;
}
commentBody = report;
}

// Find existing bot validation comment and update it, or create a new one
const MARKER = '<!-- pr-validation-bot -->';
commentBody = MARKER + '\n' + commentBody;

let existing = null;
let page = 1;
while (!existing) {
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
per_page: 100,
page: page
});
if (comments.length === 0) break;
existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(MARKER)) || null;
if (comments.length < 100) break;
page++;
}

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: commentBody
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: report
body: commentBody
});
}

Expand All @@ -299,19 +320,7 @@ This PR follows all required contributing guidelines! Thank you for following be

// Only add checklist if PR doesn't already have one
if (!body.includes('- [') && !body.includes('- [ ]')) {
const checklist = `### 📝 Pre-submission Checklist

Before merging, please ensure:

- [ ] Code follows project coding standards
- [ ] Self-reviewed code changes
- [ ] Added comments for complex logic
- [ ] Updated documentation for functionality changes
- [ ] No new warnings generated
- [ ] Tests added/updated and passing
- [ ] Dependent changes merged and published

You can check these items in your PR description or as you work through them.`;
const checklist = '### 📝 Pre-submission Checklist\n\nBefore merging, please ensure:\n\n- [ ] Code follows project coding standards\n- [ ] Self-reviewed code changes\n- [ ] Added comments for complex logic\n- [ ] Updated documentation for functionality changes\n- [ ] No new warnings generated\n- [ ] Tests added/updated and passing\n- [ ] Dependent changes merged and published\n\nYou can check these items in your PR description or as you work through them.';

await github.rest.issues.createComment({
owner: context.repo.owner,
Expand Down
Loading