@@ -13,55 +13,45 @@ export interface OpenWorkflowRunLogsCommandArgs {
1313
1414export function registerOpenWorkflowRunLogs ( context : vscode . ExtensionContext ) {
1515 context . subscriptions . push (
16- vscode . commands . registerCommand (
17- "github-actions.workflow.logs" ,
18- async ( args : OpenWorkflowRunLogsCommandArgs ) => {
19- const gitHubRepoContext = args . gitHubRepoContext ;
20- const job = args . job ;
21- const step = args . step ;
22- const uri = buildLogURI (
23- `%23${ job . run_id } - ${ job . name } ` ,
24- gitHubRepoContext . owner ,
25- gitHubRepoContext . name ,
26- job . id
27- ) ;
16+ vscode . commands . registerCommand ( "github-actions.workflow.logs" , async ( args : OpenWorkflowRunLogsCommandArgs ) => {
17+ const gitHubRepoContext = args . gitHubRepoContext ;
18+ const job = args . job ;
19+ const step = args . step ;
20+ const uri = buildLogURI (
21+ `%23${ job . run_id } - ${ job . name } ` ,
22+ gitHubRepoContext . owner ,
23+ gitHubRepoContext . name ,
24+ job . id ,
25+ ) ;
2826
29- const doc = await vscode . workspace . openTextDocument ( uri ) ;
30- const editor = await vscode . window . showTextDocument ( doc , {
31- preview : false ,
32- } ) ;
27+ const doc = await vscode . workspace . openTextDocument ( uri ) ;
28+ const editor = await vscode . window . showTextDocument ( doc , {
29+ preview : false ,
30+ } ) ;
3331
34- const logInfo = getLogInfo ( uri ) ;
35- if ( ! logInfo ) {
36- throw new Error ( "Could not get log info" ) ;
37- }
32+ const logInfo = getLogInfo ( uri ) ;
33+ if ( ! logInfo ) {
34+ throw new Error ( "Could not get log info" ) ;
35+ }
3836
39- // Custom formatting after the editor has been opened
40- updateDecorations ( editor , logInfo ) ;
37+ // Custom formatting after the editor has been opened
38+ updateDecorations ( editor , logInfo ) ;
4139
42- // Deep linking to steps
43- if ( step ) {
44- let matchingSection = logInfo . sections . find (
45- ( s ) => s . name && s . name === step . name
46- ) ;
47- if ( ! matchingSection ) {
48- // If we cannot match by name, see if we can try to match by number
49- matchingSection = logInfo . sections [ step . number - 1 ] ;
50- }
40+ // Deep linking to steps
41+ if ( step ) {
42+ let matchingSection = logInfo . sections . find ( ( s ) => s . name && s . name === step . name ) ;
43+ if ( ! matchingSection ) {
44+ // If we cannot match by name, see if we can try to match by number
45+ matchingSection = logInfo . sections [ step . number - 1 ] ;
46+ }
5147
52- if ( matchingSection ) {
53- editor . revealRange (
54- new vscode . Range (
55- matchingSection . start ,
56- 0 ,
57- matchingSection . start ,
58- 0
59- ) ,
60- vscode . TextEditorRevealType . InCenter
61- ) ;
62- }
48+ if ( matchingSection ) {
49+ editor . revealRange (
50+ new vscode . Range ( matchingSection . start , 0 , matchingSection . start , 0 ) ,
51+ vscode . TextEditorRevealType . InCenter ,
52+ ) ;
6353 }
6454 }
65- )
55+ } ) ,
6656 ) ;
6757}
0 commit comments