Skip to content

Commit 1da16e2

Browse files
committed
fix: remove dry-run logic as it doesn't work for automatic triggers
Signed-off-by: Mounil <[email protected]>
1 parent 2b6c379 commit 1da16e2

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

.github/scripts/coderabbit_plan_trigger.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22

33
const marker = '<!-- CodeRabbit Plan Trigger -->';
44

5-
async function triggerCodeRabbitPlan(github, owner, repo, issue, marker, dryRun) {
5+
async function triggerCodeRabbitPlan(github, owner, repo, issue, marker) {
66
const comment = `${marker} @coderabbitai plan`;
77

88
try {
9-
if (dryRun === 'true') {
10-
console.log(`DRY RUN: Would post CodeRabbit plan comment for issue #${issue.number}`);
11-
console.log(`Comment content: ${comment}`);
12-
return true;
13-
}
14-
159
await github.rest.issues.createComment({
1610
owner,
1711
repo,
@@ -31,7 +25,7 @@ function hasIntermediateOrAdvancedLabel(issue, label) {
3125
const hasIntermediateLabel = issue.labels?.some(l => l?.name?.toLowerCase() === 'intermediate');
3226
const hasAdvancedLabel = issue.labels?.some(l => l?.name?.toLowerCase() === 'advanced');
3327

34-
// Also check if the newly added label is intermediate/advanced
28+
// Also check if newly added label is intermediate/advanced
3529
const isNewLabelIntermediate = label?.name?.toLowerCase() === 'intermediate';
3630
const isNewLabelAdvanced = label?.name?.toLowerCase() === 'advanced';
3731

@@ -55,20 +49,18 @@ async function hasExistingCodeRabbitPlan(github, owner, repo, issueNumber) {
5549
return comments.some(c => c.body?.includes('@coderabbitai plan'));
5650
}
5751

58-
function logSummary(owner, repo, issue, dryRun) {
52+
function logSummary(owner, repo, issue) {
5953
console.log('=== Summary ===');
6054
console.log(`Repository: ${owner}/${repo}`);
6155
console.log(`Issue Number: ${issue.number}`);
6256
console.log(`Issue Title: ${issue.title || '(no title)'}`);
6357
console.log(`Labels: ${issue.labels?.map(l => l.name).join(', ') || 'none'}`);
64-
console.log(`Dry Run: ${dryRun}`);
6558
}
6659

6760
module.exports = async ({ github, context }) => {
6861
try {
6962
const { owner, repo } = context.repo;
7063
const { issue, label } = context.payload;
71-
const dryRun = process.env.DRY_RUN || 'false';
7264

7365
// Validations
7466
if (!issue?.number) return console.log('No issue in payload');
@@ -82,9 +74,9 @@ module.exports = async ({ github, context }) => {
8274
}
8375

8476
// Post CodeRabbit plan trigger
85-
await triggerCodeRabbitPlan(github, owner, repo, issue, marker, dryRun);
77+
await triggerCodeRabbitPlan(github, owner, repo, issue, marker);
8678

87-
logSummary(owner, repo, issue, dryRun);
79+
logSummary(owner, repo, issue);
8880
} catch (err) {
8981
console.log('❌ Error:', err.message);
9082
}

.github/workflows/bot-coderabbit-plan-trigger.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ on:
44
issues:
55
types: [opened, labeled]
66
workflow_dispatch:
7-
inputs:
8-
dry_run:
9-
description: 'Run in dry-run mode (no comments will be posted)'
10-
required: false
11-
default: 'true'
12-
type: string
137

148
permissions:
159
issues: write
@@ -43,7 +37,6 @@ jobs:
4337
- name: Trigger CodeRabbit Plan
4438
env:
4539
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
4740
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd #v8.0.0
4841
with:
4942
script: |

0 commit comments

Comments
 (0)