Skip to content

chore(deps): bump the rust-all group across 1 directory with 8 updates #48

chore(deps): bump the rust-all group across 1 directory with 8 updates

chore(deps): bump the rust-all group across 1 directory with 8 updates #48

name: PR Intake Checks
on:
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
pr-intake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
.github
sparse-checkout-cone-mode: false
- name: Check PR and post feedback
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const body = pr.body || '';
const title = pr.title || '';
const warnings = [];
const blocking = [];
// Check PR template sections
const requiredSections = [
'Summary',
'Problem statement',
'Proposed solution',
'Acceptance criteria'
];
const missingSections = requiredSections.filter(section =>
!body.includes(section)
);
if (missingSections.length > 0) {
warnings.push(`Missing sections: ${missingSections.join(', ')}`);
}
// Check for issue reference
if (!/#\d+/.test(body) && !/#\d+/.test(title)) {
warnings.push('No issue reference found (recommended for traceability)');
}
// Check for large PR
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const totalChanges = files.reduce((sum, f) => sum + f.additions + f.deletions, 0);
if (totalChanges > 500) {
warnings.push(`Large PR: ${totalChanges} lines changed`);
}
// Check for merge conflicts
for (const file of files) {
if (file.patch && (file.patch.includes('<<<<<<<') || file.patch.includes('=======') || file.patch.includes('>>>>>>>'))) {
blocking.push(`Merge conflicts in ${file.filename}`);
}
}
// Build comment
let commentBody = '';
if (blocking.length > 0) {
commentBody += '## PR Intake Checks - Blocking Issues\n\n';
commentBody += '❌ These issues must be resolved before merging:\n\n';
blocking.forEach(e => commentBody += `- ${e}\n`);
commentBody += '\n---\n\n';
}
if (warnings.length > 0) {
commentBody += '## PR Intake Checks - Warnings (non-blocking)\n\n';
commentBody += 'The following are recommendations:\n\n';
warnings.forEach(w => commentBody += `- ${w}\n`);
}
if (commentBody) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
}
if (blocking.length > 0) {
core.setFailed('Blocking issues found in PR');
}