@@ -969,6 +969,54 @@ export class GitHubRepository extends Disposable {
969969 return jobs . data . jobs ;
970970 }
971971
972+ async getCheckRunLogs ( checkRunDatabaseId : number ) : Promise < string > {
973+ Logger . debug ( `Fetch check run logs - enter` , this . id ) ;
974+ const { octokit, remote } = await this . ensure ( ) ;
975+
976+ // Try GitHub Actions logs first (works for Actions workflow runs)
977+ try {
978+ const result = await octokit . call ( octokit . api . actions . downloadJobLogsForWorkflowRun , {
979+ owner : remote . owner ,
980+ repo : remote . repositoryName ,
981+ job_id : checkRunDatabaseId ,
982+ } ) ;
983+ Logger . debug ( `Fetch check run logs via Actions API - done` , this . id ) ;
984+ return result . data as string ;
985+ } catch {
986+ // Not a GitHub Actions job - fall through to Checks API
987+ }
988+
989+ // Fall back to Checks API output (works for any GitHub App, e.g. Azure Pipelines)
990+ try {
991+ const result = await octokit . call ( octokit . api . checks . get , {
992+ owner : remote . owner ,
993+ repo : remote . repositoryName ,
994+ check_run_id : checkRunDatabaseId ,
995+ } ) ;
996+ const output = result . data . output ;
997+ const parts : string [ ] = [ ] ;
998+ if ( output . title ) {
999+ parts . push ( output . title ) ;
1000+ parts . push ( '' ) ;
1001+ }
1002+ if ( output . summary ) {
1003+ parts . push ( output . summary ) ;
1004+ parts . push ( '' ) ;
1005+ }
1006+ if ( output . text ) {
1007+ parts . push ( output . text ) ;
1008+ }
1009+ if ( parts . length === 0 ) {
1010+ return 'No log output available for this check run.' ;
1011+ }
1012+ Logger . debug ( `Fetch check run logs via Checks API - done` , this . id ) ;
1013+ return parts . join ( '\n' ) ;
1014+ } catch ( e ) {
1015+ Logger . error ( `Unable to fetch check run logs: ${ e } ` , this . id ) ;
1016+ throw e ;
1017+ }
1018+ }
1019+
9721020 async fork ( ) : Promise < string | undefined > {
9731021 try {
9741022 Logger . debug ( `Fork repository` , this . id ) ;
@@ -1700,6 +1748,7 @@ export class GitHubRepository extends Disposable {
17001748 if ( isCheckRun ( context ) ) {
17011749 return {
17021750 id : context . id ,
1751+ databaseId : context . databaseId ,
17031752 url : context . checkSuite ?. app ?. url ,
17041753 avatarUrl :
17051754 context . checkSuite ?. app ?. logoUrl &&
@@ -1715,10 +1764,12 @@ export class GitHubRepository extends Disposable {
17151764 event : context . checkSuite ?. workflowRun ?. event ,
17161765 targetUrl : context . detailsUrl ,
17171766 isRequired : context . isRequired ,
1767+ isCheckRun : true ,
17181768 } ;
17191769 } else {
17201770 return {
17211771 id : context . id ,
1772+ databaseId : undefined ,
17221773 url : context . targetUrl ?? undefined ,
17231774 avatarUrl : context . avatarUrl
17241775 ? getAvatarWithEnterpriseFallback ( context . avatarUrl , undefined , this . remote . isEnterprise )
@@ -1730,6 +1781,7 @@ export class GitHubRepository extends Disposable {
17301781 event : undefined ,
17311782 targetUrl : context . targetUrl ,
17321783 isRequired : context . isRequired ,
1784+ isCheckRun : false ,
17331785 } ;
17341786 }
17351787 } ) ) ;
@@ -1750,6 +1802,7 @@ export class GitHubRepository extends Disposable {
17501802 checks . state = CheckState . Pending ;
17511803 checks . statuses . push ( {
17521804 id : '' ,
1805+ databaseId : undefined ,
17531806 url : undefined ,
17541807 avatarUrl : undefined ,
17551808 state : CheckState . Pending ,
@@ -1758,7 +1811,8 @@ export class GitHubRepository extends Disposable {
17581811 workflowName : undefined ,
17591812 event : undefined ,
17601813 targetUrl : prUrl ,
1761- isRequired : true
1814+ isRequired : true ,
1815+ isCheckRun : false
17621816 } ) ;
17631817 }
17641818 }
0 commit comments