22
33const 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
6760module . 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 }
0 commit comments