Skip to content

Commit 7a58e31

Browse files
committed
add details text
1 parent 4c62099 commit 7a58e31

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ async function main() {
5858
}
5959

6060
const toolchain = patch.endsWith('-nightly') ? 'Nightly' : patch.endsWith('-beta') ? 'Beta' : 'Stable';
61-
6261
const client = getOctokit(inputs['github-token']);
6362
const sha = context.sha;
6463
let canPerformCheckRun = false;
@@ -69,9 +68,9 @@ async function main() {
6968
const { data: newRunData } = await client.request('POST /repos/{owner}/{repo}/check-runs', {
7069
owner: context.repo.owner,
7170
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+
}`,
7574
head_sha: sha,
7675
status: 'in_progress',
7776
started_at: startedAt.toISOString()
@@ -93,8 +92,8 @@ async function main() {
9392
const renderer = clippy.kDefaultRenderer;
9493
const os = osInfo.os.get();
9594
const arch = osInfo.arch.get();
96-
9795
if (canPerformCheckRun && id !== null) {
96+
const completed = new Date();
9897
const { data } = await client.request('PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}', {
9998
check_run_id: id,
10099
owner: context.repo.owner,
@@ -104,14 +103,19 @@ async function main() {
104103
status: 'completed',
105104
conclusion: exitCode === 0 ? 'success' : 'failure',
106105
started_at: startedAt.toISOString(),
107-
completed_at: new Date().toISOString(),
108-
name: `Clippy Result (${toolchain.toLowerCase()})`,
106+
completed_at: completed.toISOString(),
109107
output:
110108
exitCode === 0
111109
? {
112110
title: `Clippy (${toolchain} ~ ${os}/${arch})`,
113111
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'),
115119
annotations: renderer.annotations.map((annotation) => ({
116120
annotation_level:
117121
annotation.level === 'error'
@@ -131,6 +135,13 @@ async function main() {
131135
: {
132136
title: `Clippy (${toolchain} ~ ${os}/${arch})`,
133137
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'),
134145
annotations: renderer.annotations.map((annotation) => ({
135146
annotation_level:
136147
annotation.level === 'error'
@@ -157,8 +168,9 @@ async function main() {
157168
}
158169

159170
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+
);
162174

163175
setFailed(error);
164176
process.exit(1);

0 commit comments

Comments
 (0)