Skip to content

Commit 1887a26

Browse files
committed
add workflow
Signed-off-by: Venky Ganesh <[email protected]>
1 parent 1f02d53 commit 1887a26

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

.github/pr-checklist.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## 🚀 PR Checklist
2+
3+
Please review and check all applicable items before requesting a review:
4+
5+
- [ ] PR title follows format: `[JIRA/Issue][type] Description`
6+
- [ ] PR description explains both **what** you're doing and **why**
7+
- [ ] Code conforms to coding conventions (see `CODING_GUIDELINES.md`)
8+
- [ ] Inputs validated and possible nullptr dereferences checked
9+
- [ ] Test cases added for new code
10+
- [ ] All existing tests pass
11+
- [ ] PR and commit messages cleaned up via `git rebase -i`
12+
13+
---
14+
**Note:** Check all applicable items and **resolve this comment** when ready for review.

.github/workflows/pr-checklist.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR Checklist
2+
on:
3+
pull_request:
4+
types: [opened, reopened]
5+
6+
permissions:
7+
pull-requests: write
8+
9+
jobs:
10+
post-checklist:
11+
runs-on: ubuntu-latest
12+
if: github.event.pull_request.draft == false
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Post PR Checklist
18+
uses: actions/github-script@v7
19+
with:
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
script: |
22+
const fs = require('fs');
23+
const path = require('path');
24+
25+
// Read checklist from file
26+
const checklistPath = path.join(process.env.GITHUB_WORKSPACE, '.github', 'pr-checklist.md');
27+
const checklistContent = fs.readFileSync(checklistPath, 'utf8');
28+
29+
// Check if we already posted a checklist comment
30+
const { data: comments } = await github.rest.issues.listComments({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: context.issue.number
34+
});
35+
36+
const checklistExists = comments.some(comment =>
37+
comment.user.login === 'github-actions[bot]' &&
38+
comment.body.includes('PR Checklist')
39+
);
40+
41+
if (!checklistExists) {
42+
await github.rest.issues.createComment({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
issue_number: context.issue.number,
46+
body: checklistContent
47+
});
48+
}

0 commit comments

Comments
 (0)