@@ -58,7 +58,6 @@ async function main() {
58
58
}
59
59
60
60
const toolchain = patch . endsWith ( '-nightly' ) ? 'Nightly' : patch . endsWith ( '-beta' ) ? 'Beta' : 'Stable' ;
61
-
62
61
const client = getOctokit ( inputs [ 'github-token' ] ) ;
63
62
const sha = context . sha ;
64
63
let canPerformCheckRun = false ;
@@ -69,9 +68,9 @@ async function main() {
69
68
const { data : newRunData } = await client . request ( 'POST /repos/{owner}/{repo}/check-runs' , {
70
69
owner : context . repo . owner ,
71
70
repo : context . repo . repo ,
72
- name : `Clippy Result (${ toolchain . toLowerCase ( ) } ${
73
- inputs [ 'working-directory' ] !== undefined ? ` ( ${ inputs [ 'working-directory' ] } ) ` : ''
74
- } ) `,
71
+ name : `Clippy Result (${ toolchain . toLowerCase ( ) } ) ${
72
+ inputs [ 'working-directory' ] !== undefined ? ` in ${ inputs [ 'working-directory' ] } ` : ''
73
+ } `,
75
74
head_sha : sha ,
76
75
status : 'in_progress' ,
77
76
started_at : startedAt . toISOString ( )
@@ -93,8 +92,8 @@ async function main() {
93
92
const renderer = clippy . kDefaultRenderer ;
94
93
const os = osInfo . os . get ( ) ;
95
94
const arch = osInfo . arch . get ( ) ;
96
-
97
95
if ( canPerformCheckRun && id !== null ) {
96
+ const completed = new Date ( ) ;
98
97
const { data } = await client . request ( 'PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}' , {
99
98
check_run_id : id ,
100
99
owner : context . repo . owner ,
@@ -104,14 +103,19 @@ async function main() {
104
103
status : 'completed' ,
105
104
conclusion : exitCode === 0 ? 'success' : 'failure' ,
106
105
started_at : startedAt . toISOString ( ) ,
107
- completed_at : new Date ( ) . toISOString ( ) ,
108
- name : `Clippy Result (${ toolchain . toLowerCase ( ) } )` ,
106
+ completed_at : completed . toISOString ( ) ,
109
107
output :
110
108
exitCode === 0
111
109
? {
112
110
title : `Clippy (${ toolchain } ~ ${ os } /${ arch } )` ,
113
111
summary : 'Clippy was successful!' ,
114
- text : '' ,
112
+ text : [
113
+ `Running \`cargo clippy\` took roughly ~${
114
+ completed . getTime ( ) - startedAt . getTime ( )
115
+ } ms to complete`,
116
+ '' ,
117
+ `* Working Directory: ${ inputs [ 'working-directory' ] || 'repository directory' } `
118
+ ] . join ( '\n' ) ,
115
119
annotations : renderer . annotations . map ( ( annotation ) => ( {
116
120
annotation_level :
117
121
annotation . level === 'error'
@@ -131,6 +135,13 @@ async function main() {
131
135
: {
132
136
title : `Clippy (${ toolchain } ~ ${ os } /${ arch } )` ,
133
137
summary : 'Clippy failed.' ,
138
+ text : [
139
+ `Running \`cargo clippy\` took roughly ~${
140
+ completed . getTime ( ) - startedAt . getTime ( )
141
+ } ms to complete`,
142
+ '' ,
143
+ `* Working Directory: ${ inputs [ 'working-directory' ] || 'repository directory' } `
144
+ ] . join ( '\n' ) ,
134
145
annotations : renderer . annotations . map ( ( annotation ) => ( {
135
146
annotation_level :
136
147
annotation . level === 'error'
@@ -157,8 +168,9 @@ async function main() {
157
168
}
158
169
159
170
main ( ) . catch ( ( ex ) => {
160
- const error : Error & { why : Error } = new Error ( '@augu/clippy-action failed to run.' ) as any ;
161
- error . why = ex ;
171
+ const error = new Error (
172
+ `@augu/clippy-action failed to run: ${ ex instanceof Error ? ex . message : JSON . stringify ( ex , null , 4 ) } `
173
+ ) ;
162
174
163
175
setFailed ( error ) ;
164
176
process . exit ( 1 ) ;
0 commit comments