Skip to content

Commit 80a476f

Browse files
committed
feat: restrict review comments to PRs only and update Claude bot instructions
1 parent 9e54cfb commit 80a476f

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

.github/workflows/auto-issue-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ jobs:
2222
issue_number: context.issue.number,
2323
owner: context.repo.owner,
2424
repo: context.repo.repo,
25-
body: '@claude review this issue and do a detailed analysis and fix this if the existing code doesn\'t have the solution implemented. Making sure it has backward compatibility, no existing features removed. After making those changes, again review the applied changes. Use @web to search if you dont know any information or to find the latest documentation or to find the latest version. Run the code if you think you need to run it to test it. Minimal code change to start with if required any changes. **Please create a PR with your changes**.'
25+
body: '@claude review this issue and do a detailed analysis and fix this if the existing code doesn\'t have the solution implemented. Making sure it has backward compatibility, no existing features removed. After making those changes, again review the applied changes. Use @web to search if you dont know any information or to find the latest documentation or to find the latest version. Run the code if you think you need to run it to test it. Minimal code change to start with if required any changes. **Please create a PR using gh tool with your changes**.'
2626
})

.github/workflows/claude.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,32 @@ jobs:
130130
github-token: ${{ secrets.GH_TOKEN }}
131131
script: |
132132
let issueNumber;
133+
let isPR = false;
133134
134-
// Determine issue/PR number based on event type
135+
// Determine issue/PR number and type based on event type
135136
if (context.eventName === 'pull_request_review_comment' || context.eventName === 'pull_request_review') {
136137
issueNumber = context.payload.pull_request?.number || context.issue.number;
138+
isPR = true;
137139
} else if (context.eventName === 'issue_comment' && context.payload.issue.pull_request) {
138140
// This is a comment on a PR (not an issue)
139141
issueNumber = context.payload.issue.number;
142+
isPR = true;
140143
} else {
141-
// This is a regular issue
144+
// This is a regular issue - don't post review comment
142145
issueNumber = context.issue.number;
146+
isPR = false;
143147
}
144148
145-
console.log(`Posting review comment on issue/PR #${issueNumber}`);
146-
147-
await github.rest.issues.createComment({
148-
issue_number: issueNumber,
149-
owner: context.repo.owner,
150-
repo: context.repo.repo,
151-
body: '@claude review if the changes made in the above branch are as per the requirements and make changes to the above branch if issues still exist. Please create a Pull Request with gh tool with your changes.'
152-
});
149+
// Only post review comment on PRs, not regular issues
150+
if (isPR) {
151+
console.log(`Posting review comment on PR #${issueNumber}`);
152+
153+
await github.rest.issues.createComment({
154+
issue_number: issueNumber,
155+
owner: context.repo.owner,
156+
repo: context.repo.repo,
157+
body: '@claude review if the changes made in the above branch are as per the requirements and make changes to the above branch if issues still exist.'
158+
});
159+
} else {
160+
console.log(`Skipping review comment for regular issue #${issueNumber}`);
161+
}

0 commit comments

Comments
 (0)