Skip to content

Commit ad3fda1

Browse files
committed
feat: enhance PR review automation with comprehensive workflows
- Improved PR template with structured sections for all change types - Enhanced CODEOWNERS with granular component-level ownership - Added PR auto-commenter for helpful context on PR creation - Added PR quality validation workflow to ensure template completion - Added PR conflict detector with resolution instructions - Added PR review reminder workflow (runs every 6 hours) These improvements will streamline PR reviews by: - Auto-assigning reviewers based on changed files (CODEOWNERS) - Providing immediate helpful feedback on PR creation - Validating PR quality (description, issue links, template completion) - Auto-detecting and notifying about merge conflicts - Reminding reviewers about pending PRs with passing CI Related: OSS readiness initiative Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
1 parent d1382ba commit ad3fda1

6 files changed

Lines changed: 543 additions & 17 deletions

File tree

.github/CODEOWNERS

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,58 @@
1-
# Default owner
1+
# CODEOWNERS - Auto-assign reviewers based on file paths
2+
# Format: path/to/file @username @team-name
3+
# See: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
4+
5+
# Default owner for everything
26
* @aviralgarg05
37

4-
# Core engine
8+
# Rust Core Components
59
/nexum_core/ @aviralgarg05
10+
/nexum_core/src/storage/ @aviralgarg05
11+
/nexum_core/src/executor/ @aviralgarg05
12+
/nexum_core/src/sql/ @aviralgarg05
13+
/nexum_core/src/catalog/ @aviralgarg05
14+
/nexum_core/src/bridge/ @aviralgarg05
15+
16+
# CLI
617
/nexum_cli/ @aviralgarg05
718

8-
# CI/CD
19+
# Python AI Components
20+
/nexum_ai/ @aviralgarg05
21+
/nexum_ai/model_manager.py @aviralgarg05
22+
/nexum_ai/optimizer.py @aviralgarg05
23+
/nexum_ai/rl_agent.py @aviralgarg05
24+
/nexum_ai/translator.py @aviralgarg05
25+
26+
# Build Configuration
27+
/Cargo.toml @aviralgarg05
28+
/Cargo.lock @aviralgarg05
29+
**/Cargo.toml @aviralgarg05
30+
31+
# Python Dependencies
32+
/nexum_ai/requirements.txt @aviralgarg05
33+
34+
# CI/CD & GitHub Configuration
935
/.github/ @aviralgarg05
36+
/.github/workflows/ @aviralgarg05
37+
/.github/dependabot.yml @aviralgarg05
38+
39+
# Documentation
40+
/README.md @aviralgarg05
41+
/CHANGELOG.md @aviralgarg05
42+
/CONTRIBUTING.md @aviralgarg05
43+
/CODE_OF_CONDUCT.md @aviralgarg05
44+
/SECURITY.md @aviralgarg05
45+
/TESTING.md @aviralgarg05
46+
/ROADMAP.md @aviralgarg05
47+
*.md @aviralgarg05
48+
49+
# Tests
50+
/tests/ @aviralgarg05
51+
52+
# Docker
53+
/Dockerfile @aviralgarg05
54+
/docker-compose.yml @aviralgarg05
55+
56+
# Scripts
57+
*.sh @aviralgarg05
58+
/demo.sh @aviralgarg05

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,75 @@
11
## Summary
2-
- What does this PR change?
3-
- Why is it needed?
2+
<!-- Provide a clear and concise description of what this PR changes and why it's needed -->
3+
4+
Closes #(issue_number) <!-- Link related issues with "Closes #123" or "Fixes #456" -->
5+
6+
### What Changed?
7+
<!-- Describe the changes in this PR -->
8+
9+
### Why?
10+
<!-- Explain the motivation behind these changes -->
11+
12+
## Type of Change
13+
<!-- Check all that apply -->
14+
- [ ] 🐛 Bug fix (non-breaking change fixing an issue)
15+
- [ ] ✨ New feature (non-breaking change adding functionality)
16+
- [ ] 💥 Breaking change (fix or feature causing existing functionality to change)
17+
- [ ] 📝 Documentation update
18+
- [ ] ♻️ Refactoring (code improvement without behavior change)
19+
- [ ] 🎨 Style/UI changes
20+
- [ ] ⚡ Performance improvement
21+
- [ ] ✅ Test addition or update
22+
- [ ] 🔧 Configuration/build changes
23+
- [ ] 🔒 Security fix
424

525
## Testing
6-
- [ ] `cargo fmt --all -- --check`
7-
- [ ] `cargo clippy --workspace --all-targets -- -D warnings`
8-
- [ ] `cargo test --workspace -- --test-threads=1`
9-
- [ ] `python -m compileall nexum_ai`
10-
- [ ] Other (describe):
11-
12-
## Checklist
13-
- [ ] Linked issue (or explained why not)
14-
- [ ] Docs updated (README/CHANGELOG/inline)
15-
- [ ] Added or updated tests
16-
- [ ] Follows Code of Conduct
26+
<!-- Describe how you tested these changes -->
27+
28+
### Local Testing Checklist
29+
- [ ] `cargo fmt --all -- --check` - Code formatting
30+
- [ ] `cargo clippy --workspace --all-targets -- -D warnings` - Linting
31+
- [ ] `cargo test --workspace -- --test-threads=1` - All tests pass
32+
- [ ] `cargo audit` - No security vulnerabilities
33+
- [ ] `python -m ruff check nexum_ai/` - Python linting (if applicable)
34+
- [ ] `python -m compileall nexum_ai` - Python compilation (if applicable)
35+
- [ ] Manual testing performed (describe below)
36+
37+
### Testing Details
38+
<!-- Describe your testing approach, edge cases covered, etc. -->
39+
40+
## Screenshots/Examples
41+
<!-- If applicable, add screenshots or code examples demonstrating the changes -->
42+
43+
## Performance Impact
44+
<!-- Describe any performance implications of these changes -->
45+
- [ ] No performance impact
46+
- [ ] Performance improvement (describe below)
47+
- [ ] Potential performance concern (describe below)
48+
49+
## Security Considerations
50+
<!-- Have you considered security implications? -->
51+
- [ ] No security concerns
52+
- [ ] Security improvement (describe below)
53+
- [ ] Requires security review (describe below)
54+
55+
## Documentation
56+
- [ ] Updated inline code comments/documentation
57+
- [ ] Updated README.md (if applicable)
58+
- [ ] Updated CHANGELOG.md (will be auto-updated on release)
59+
- [ ] Updated TESTING.md (if test procedures changed)
60+
- [ ] Added/updated examples in `demo.sh` (if applicable)
61+
62+
## Pre-Merge Checklist
63+
- [ ] Self-reviewed my own code
64+
- [ ] Added tests covering my changes
65+
- [ ] All existing tests pass locally
66+
- [ ] Updated relevant documentation
67+
- [ ] No uncommitted debug code or console logs
68+
- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
69+
- [ ] Follows [Code of Conduct](CODE_OF_CONDUCT.md)
70+
- [ ] Branch is up to date with `main`
1771

1872
## Additional Notes
19-
- Risks, deployment notes, or follow-up tasks.
73+
<!-- Any additional context, deployment notes, follow-up tasks, or breaking changes details -->
74+
75+
**Reviewers**: Please check that all checkboxes are ticked before approving ✅

.github/workflows/pr-commenter.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: PR Auto Commenter
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
permissions:
8+
pull-requests: write
9+
contents: read
10+
11+
jobs:
12+
welcome-comment:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Add helpful comment to PR
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const prAuthor = context.payload.pull_request.user.login;
20+
const prNumber = context.payload.pull_request.number;
21+
const prTitle = context.payload.pull_request.title;
22+
23+
// Get files changed
24+
const { data: files } = await github.rest.pulls.listFiles({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
pull_number: prNumber,
28+
});
29+
30+
const changedFiles = files.map(f => f.filename);
31+
const hasRustChanges = changedFiles.some(f => f.endsWith('.rs'));
32+
const hasPythonChanges = changedFiles.some(f => f.endsWith('.py'));
33+
const hasDocChanges = changedFiles.some(f => f.endsWith('.md'));
34+
const hasCIChanges = changedFiles.some(f => f.startsWith('.github/workflows/'));
35+
const hasTestChanges = changedFiles.some(f => f.includes('test'));
36+
37+
let comment = `## 🎉 Thank you for your contribution, @${prAuthor}!\n\n`;
38+
comment += `### 📋 PR Analysis\n\n`;
39+
comment += `**Files Changed:** ${files.length}\n`;
40+
comment += `**Components:**\n`;
41+
if (hasRustChanges) comment += `- 🦀 Rust core changes detected\n`;
42+
if (hasPythonChanges) comment += `- 🐍 Python AI components changed\n`;
43+
if (hasDocChanges) comment += `- 📝 Documentation updates\n`;
44+
if (hasCIChanges) comment += `- ⚙️ CI/CD workflow changes\n`;
45+
if (hasTestChanges) comment += `- ✅ Test changes included\n`;
46+
47+
comment += `\n### ⚡ Quick Checks\n\n`;
48+
comment += `Before requesting review, please ensure:\n`;
49+
comment += `- [ ] All CI checks are passing ✅\n`;
50+
comment += `- [ ] PR template checkboxes are completed\n`;
51+
comment += `- [ ] Linked related issue(s)\n`;
52+
comment += `- [ ] Added/updated tests for changes\n`;
53+
comment += `- [ ] Documentation updated if needed\n\n`;
54+
55+
if (hasRustChanges) {
56+
comment += `### 🦀 Rust Changes Noticed\n`;
57+
comment += `Run locally before pushing:\n`;
58+
comment += `\`\`\`bash\n`;
59+
comment += `cargo fmt --all\n`;
60+
comment += `cargo clippy --workspace --all-targets -- -D warnings\n`;
61+
comment += `cargo test --workspace -- --test-threads=1\n`;
62+
comment += `\`\`\`\n\n`;
63+
}
64+
65+
if (hasPythonChanges) {
66+
comment += `### 🐍 Python Changes Noticed\n`;
67+
comment += `Run locally before pushing:\n`;
68+
comment += `\`\`\`bash\n`;
69+
comment += `python -m ruff check nexum_ai/\n`;
70+
comment += `python -m compileall nexum_ai/\n`;
71+
comment += `\`\`\`\n\n`;
72+
}
73+
74+
comment += `---\n`;
75+
comment += `💡 **Tip:** CodeRabbit will automatically review your PR. Address any feedback before requesting human review.\n`;
76+
comment += `📚 New to contributing? Check out [CONTRIBUTING.md](../blob/main/CONTRIBUTING.md) for guidelines.\n`;
77+
78+
await github.rest.issues.createComment({
79+
owner: context.repo.owner,
80+
repo: context.repo.repo,
81+
issue_number: prNumber,
82+
body: comment
83+
});

.github/workflows/pr-conflicts.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: PR Conflict Detector
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
# Also run when main branch is updated
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
pull-requests: write
13+
contents: read
14+
15+
jobs:
16+
check-conflicts:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check for merge conflicts
20+
uses: actions/github-script@v7
21+
with:
22+
script: |
23+
let prs = [];
24+
25+
if (context.eventName === 'pull_request') {
26+
// Check current PR only
27+
prs = [context.payload.pull_request];
28+
} else {
29+
// Check all open PRs when main is updated
30+
const { data: openPRs } = await github.rest.pulls.list({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
state: 'open',
34+
per_page: 100
35+
});
36+
prs = openPRs;
37+
}
38+
39+
for (const pr of prs) {
40+
// Get fresh PR data
41+
const { data: prData } = await github.rest.pulls.get({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
pull_number: pr.number
45+
});
46+
47+
if (prData.mergeable_state === 'dirty' || prData.mergeable === false) {
48+
// Get existing comments
49+
const { data: comments } = await github.rest.issues.listComments({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
issue_number: pr.number
53+
});
54+
55+
const hasConflictComment = comments.some(c =>
56+
c.body.includes('⚠️ Merge Conflict Detected') &&
57+
c.user.type === 'Bot'
58+
);
59+
60+
// Only comment if no recent conflict comment exists
61+
if (!hasConflictComment) {
62+
const comment = `## ⚠️ Merge Conflict Detected\n\n` +
63+
`This PR has merge conflicts with the \`main\` branch that must be resolved before it can be merged.\n\n` +
64+
`### 🔧 How to Resolve:\n\n` +
65+
`**Option 1: Update from main**\n` +
66+
`\`\`\`bash\n` +
67+
`git checkout main\n` +
68+
`git pull origin main\n` +
69+
`git checkout ${prData.head.ref}\n` +
70+
`git merge main\n` +
71+
`# Resolve conflicts in your editor\n` +
72+
`git add .\n` +
73+
`git commit -m "chore: resolve merge conflicts with main"\n` +
74+
`git push\n` +
75+
`\`\`\`\n\n` +
76+
`**Option 2: Rebase (advanced)**\n` +
77+
`\`\`\`bash\n` +
78+
`git checkout ${prData.head.ref}\n` +
79+
`git fetch origin\n` +
80+
`git rebase origin/main\n` +
81+
`# Resolve conflicts in your editor\n` +
82+
`git add .\n` +
83+
`git rebase --continue\n` +
84+
`git push --force-with-lease\n` +
85+
`\`\`\`\n\n` +
86+
`---\n` +
87+
`💡 Need help? Check out [GitHub's guide on resolving merge conflicts](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line).\n`;
88+
89+
await github.rest.issues.createComment({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
issue_number: pr.number,
93+
body: comment
94+
});
95+
96+
console.log(`Posted conflict notice for PR #${pr.number}`);
97+
}
98+
} else if (prData.mergeable === true) {
99+
// PR is mergeable - remove old conflict comments if any
100+
const { data: comments } = await github.rest.issues.listComments({
101+
owner: context.repo.owner,
102+
repo: context.repo.repo,
103+
issue_number: pr.number
104+
});
105+
106+
const conflictComments = comments.filter(c =>
107+
c.body.includes('⚠️ Merge Conflict Detected') &&
108+
c.user.type === 'Bot'
109+
);
110+
111+
for (const comment of conflictComments) {
112+
await github.rest.issues.deleteComment({
113+
owner: context.repo.owner,
114+
repo: context.repo.repo,
115+
comment_id: comment.id
116+
});
117+
console.log(`Removed resolved conflict comment from PR #${pr.number}`);
118+
}
119+
}
120+
}
121+
122+
console.log('Conflict check completed');

0 commit comments

Comments
 (0)