@@ -32,6 +32,18 @@ function getRandomLoadingPhrase(): string {
32
32
return LOADING_PHRASES [ Math . floor ( Math . random ( ) * LOADING_PHRASES . length ) ] ;
33
33
}
34
34
35
+ /**
36
+ * Construct a URL to the current GitHub Actions run.
37
+ * @returns A URL string if context vars are set, otherwise null.
38
+ */
39
+ function getRunUrl ( ) : string | null {
40
+ const server = process . env . GITHUB_SERVER_URL || 'https://github.com' ;
41
+ const repo = process . env . GITHUB_REPOSITORY ;
42
+ const runId = process . env . GITHUB_RUN_ID ;
43
+ if ( ! repo || ! runId ) return null ;
44
+ return `${ server } /${ repo } /actions/runs/${ runId } ` ;
45
+ }
46
+
35
47
/**
36
48
* Create a GitHub comment to display initial progress steps with checkboxes.
37
49
* @param octokit - Authenticated Octokit client.
@@ -47,7 +59,8 @@ export async function createProgressComment(
47
59
steps : string [ ] ,
48
60
) : Promise < number > {
49
61
const emptyBar = '░' . repeat ( PROGRESS_BAR_BLOCKS ) ;
50
- const body = [
62
+ const runUrl = getRunUrl ( ) ;
63
+ const lines = [
51
64
PROGRESS_TITLE ,
52
65
'' ,
53
66
`Progress: [${ emptyBar } ] 0%` ,
@@ -59,7 +72,11 @@ export async function createProgressComment(
59
72
return i === 0 ? `${ checkbox } ${ SPINNER_HTML } ` : checkbox ;
60
73
} ) ,
61
74
'' ,
62
- ] . join ( '\n' ) ;
75
+ ] ;
76
+ if ( runUrl ) {
77
+ lines . push ( `[View job run](${ runUrl } )` , '' ) ;
78
+ }
79
+ const body = lines . join ( '\n' ) ;
63
80
if ( 'issue' in event ) {
64
81
const { data } = await octokit . rest . issues . createComment ( {
65
82
...repo ,
@@ -104,7 +121,8 @@ export async function updateProgressComment(
104
121
const bar = '█' . repeat ( filled ) + '░' . repeat ( PROGRESS_BAR_BLOCKS - filled ) ;
105
122
const percent = Math . round ( ( completed / total ) * 100 ) ;
106
123
107
- const body = [
124
+ const runUrl = getRunUrl ( ) ;
125
+ const lines = [
108
126
PROGRESS_TITLE ,
109
127
'' ,
110
128
`Progress: ${ bar } ${ percent } %${ percent === 100 ? ' ✅' : '' } ` ,
@@ -115,7 +133,11 @@ export async function updateProgressComment(
115
133
i === completed && completed !== total ? `${ line } ${ SPINNER_HTML } ` : line ,
116
134
) ,
117
135
'' ,
118
- ] . join ( '\n' ) ;
136
+ ] ;
137
+ if ( runUrl ) {
138
+ lines . push ( `[View job run](${ runUrl } )` , '' ) ;
139
+ }
140
+ const body = lines . join ( '\n' ) ;
119
141
if ( 'issue' in event ) {
120
142
await octokit . rest . issues . updateComment ( {
121
143
...repo ,
0 commit comments