@@ -18,6 +18,9 @@ export async function processReview(
1818 : { installationId }
1919 ) ;
2020
21+ // Skip check runs in GitHub Actions mode (workflow provides its own)
22+ const manageChecks = process . env . GITHUB_ACTIONS !== 'true' ;
23+
2124 try {
2225 // Extract PR information
2326 const prNumber = payload . pull_request . number ;
@@ -35,16 +38,20 @@ export async function processReview(
3538 // Generate PR URL
3639 const prUrl = payload . pull_request . html_url ;
3740
38- // Create check run
39- const checkRun = await githubClient . createCheckRun ( owner , repo , commitSha , {
40- name : config . github . check_name ,
41- status : CHECK_STATUS . IN_PROGRESS ,
42- output : {
43- title : 'Code Review' ,
44- summary : 'Analyzing changes...' ,
45- } ,
46- details_url : prUrl ,
47- } ) ;
41+ // Create check run (only in webhook mode)
42+ let checkRunId : number | undefined ;
43+ if ( manageChecks ) {
44+ const checkRun = await githubClient . createCheckRun ( owner , repo , commitSha , {
45+ name : config . github . check_name ,
46+ status : CHECK_STATUS . IN_PROGRESS ,
47+ output : {
48+ title : 'Code Review' ,
49+ summary : 'Analyzing changes...' ,
50+ } ,
51+ details_url : prUrl ,
52+ } ) ;
53+ checkRunId = checkRun . id ;
54+ }
4855
4956 // Get diff content from GitHub API
5057 console . log ( 'Fetching diff content from GitHub API...' ) ;
@@ -53,16 +60,18 @@ export async function processReview(
5360 if ( ! diffContent ) {
5461 console . log ( 'No diff content found, completing review without analysis' ) ;
5562
56- // Update check run with success since there's nothing to review
57- await githubClient . updateCheckRun ( owner , repo , checkRun . id , {
58- status : CHECK_STATUS . COMPLETED ,
59- conclusion : CHECK_CONCLUSION . SUCCESS ,
60- output : {
61- title : 'Code Review Completed' ,
62- summary : 'No reviewable changes found based on configured file patterns.' ,
63- } ,
64- details_url : prUrl ,
65- } ) ;
63+ // Update check run with success since there's nothing to review (only in webhook mode)
64+ if ( manageChecks && checkRunId ) {
65+ await githubClient . updateCheckRun ( owner , repo , checkRunId , {
66+ status : CHECK_STATUS . COMPLETED ,
67+ conclusion : CHECK_CONCLUSION . SUCCESS ,
68+ output : {
69+ title : 'Code Review Completed' ,
70+ summary : 'No reviewable changes found based on configured file patterns.' ,
71+ } ,
72+ details_url : prUrl ,
73+ } ) ;
74+ }
6675
6776 return ;
6877 }
@@ -147,27 +156,31 @@ export async function processReview(
147156 console . log ( 'No comments file found, skipping review creation' ) ;
148157 }
149158
150- // Update check run with success (simplified since review details are now in PR review)
151- await githubClient . updateCheckRun ( owner , repo , checkRun . id , {
152- status : CHECK_STATUS . COMPLETED ,
153- conclusion : CHECK_CONCLUSION . SUCCESS ,
154- output : {
155- title : 'Code Review Completed' ,
156- summary : 'Code review has been completed successfully. See PR conversation for details.' ,
157- } ,
158- details_url : prUrl ,
159- actions : [ {
160- label : 'Re-run review' ,
161- description : 'Request a new code review for this PR' ,
162- identifier : 're-run-review'
163- } ]
164- } ) ;
159+ // Update check run with success (only in webhook mode)
160+ if ( manageChecks && checkRunId ) {
161+ await githubClient . updateCheckRun ( owner , repo , checkRunId , {
162+ status : CHECK_STATUS . COMPLETED ,
163+ conclusion : CHECK_CONCLUSION . SUCCESS ,
164+ output : {
165+ title : 'Code Review Completed' ,
166+ summary : 'Code review has been completed successfully. See PR conversation for details.' ,
167+ } ,
168+ details_url : prUrl ,
169+ actions : [ {
170+ label : 'Re-run review' ,
171+ description : 'Request a new code review for this PR' ,
172+ identifier : 're-run-review'
173+ } ]
174+ } ) ;
175+ }
165176
166177 } catch ( error ) {
167178 console . error ( `Review job ${ jobId } failed with exception:` , error ) ;
168179
169- // Post FAILED check run for exceptions
170- await postFailureCheckRun ( githubClient , payload , error instanceof Error ? error . message : String ( error ) ) ;
180+ // Post FAILED check run for exceptions (only in webhook mode)
181+ if ( manageChecks ) {
182+ await postFailureCheckRun ( githubClient , payload , error instanceof Error ? error . message : String ( error ) ) ;
183+ }
171184 }
172185}
173186
@@ -176,7 +189,7 @@ async function postFailureCheckRun(
176189 payload : GitHubPullRequestEvent ,
177190 errorMessage : string
178191) : Promise < void > {
179- const config = getConfig ( ) ;
192+ const config = await getConfig ( ) ;
180193
181194 try {
182195 const commitSha = payload . pull_request . head . sha ;
0 commit comments