11import * as core from '@actions/core' ;
22import * as github from '@actions/github' ;
33import { getConfig } from './config' ;
4- import { AsymptoteClient , RateLimitError , TimeoutError } from './api/client' ;
4+ import {
5+ AsymptoteClient ,
6+ RateLimitError ,
7+ shouldSkipLegacyActionForIntegration ,
8+ TimeoutError ,
9+ } from './api/client' ;
510import { getPRDiff , getIncrementalDiff } from './github/diff' ;
611import { postViolationComments , resolveOutdatedThreads } from './github.qkg1.topments' ;
712import { createCheckRun } from './github/checks' ;
@@ -16,6 +21,11 @@ async function run(): Promise<void> {
1621 core . info ( 'Asymptote Security Scan starting...' ) ;
1722 core . debug ( `API URL: ${ config . apiUrl } ` ) ;
1823
24+ const client = new AsymptoteClient ( {
25+ apiKey : config . apiKey ,
26+ baseUrl : config . apiUrl ,
27+ } ) ;
28+
1929 // 2. Verify PR context
2030 if ( github . context . eventName !== 'pull_request' ) {
2131 core . setFailed (
@@ -34,6 +44,28 @@ async function run(): Promise<void> {
3444 }
3545 const octokit = github . getOctokit ( githubToken ) ;
3646
47+ try {
48+ const integration = await client . getRepositoryIntegrationMode (
49+ github . context . repo . owner ,
50+ github . context . repo . repo
51+ ) ;
52+ if ( shouldSkipLegacyActionForIntegration ( integration ) ) {
53+ core . info (
54+ 'Repository is configured for GitHub App PR reviews; exiting legacy action without posting comments or checks.'
55+ ) ;
56+ core . setOutput ( 'decision' , 'allow' ) ;
57+ core . setOutput ( 'total_violations' , 0 ) ;
58+ core . setOutput ( 'critical_count' , 0 ) ;
59+ core . setOutput ( 'high_count' , 0 ) ;
60+ core . setOutput ( 'medium_count' , 0 ) ;
61+ return ;
62+ }
63+ } catch ( error ) {
64+ core . warning (
65+ `Failed to look up repository integration mode; continuing with legacy action path. ${ error instanceof Error ? error . message : String ( error ) } `
66+ ) ;
67+ }
68+
3769 // 4. Get PR diff (incremental on synchronize, full otherwise)
3870 const action = github . context . payload . action ;
3971 const before = github . context . payload . before ;
@@ -140,10 +172,6 @@ async function run(): Promise<void> {
140172
141173 // 5. Call Asymptote API
142174 core . info ( 'Submitting diff for evaluation...' ) ;
143- const client = new AsymptoteClient ( {
144- apiKey : config . apiKey ,
145- baseUrl : config . apiUrl ,
146- } ) ;
147175
148176 let result ;
149177 try {
0 commit comments