Skip to content

Commit

Permalink
Codechange: improve output of annotations check
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 committed Dec 7, 2024
1 parent e2db71e commit 145a1e2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
35 changes: 18 additions & 17 deletions annotation-check/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29190,25 +29190,26 @@ function run() {
core.info('Overview of jobs:');
let count = 0;
for (const check_run of list_runs.data.check_runs) {
if (check_run.output.title) {
core.info(`- ${check_run.output.title}: ${check_run.output.summary}`);
}
if (check_run.output.annotations_count > 0) {
const annotations = yield octokit.rest.checks.listAnnotations({
owner,
repo,
check_run_id: check_run.id
});
for (const annotation of annotations.data) {
core.info(`${annotation.path}:${annotation.start_line} - ${annotation.message}`);
if (annotation.annotation_level === 'warning' && annotation.path === '.github') {
// Ignore warning annotations to do with the CI. Likely *-latest upgrade notices
}
else {
count += 1;
}
if (check_run.output.annotations_count == 0)
continue;
core.startGroup(`${check_run.name}`);
const annotations = yield octokit.rest.checks.listAnnotations({
owner,
repo,
check_run_id: check_run.id
});
for (const annotation of annotations.data) {
let message = `${annotation.path}:${annotation.start_line} - ${annotation.message}`;
if (annotation.annotation_level === 'warning' && annotation.path === '.github') {
// Ignore warning annotations to do with the CI. Likely *-latest upgrade notices
message += " (ignored)";
}
else {
count += 1;
}
core.info(message);
}
core.endGroup();
}
if (count === 0) {
core.info('No annotations found');
Expand Down
32 changes: 16 additions & 16 deletions annotation-check/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ async function run(): Promise<void> {

let count = 0
for (const check_run of list_runs.data.check_runs) {
if (check_run.output.title) {
core.info(`- ${check_run.output.title}: ${check_run.output.summary}`)
}
if (check_run.output.annotations_count > 0) {
const annotations = await octokit.rest.checks.listAnnotations({
owner,
repo,
check_run_id: check_run.id
})
if (check_run.output.annotations_count == 0) continue
core.startGroup(`${check_run.name}`)
const annotations = await octokit.rest.checks.listAnnotations({
owner,
repo,
check_run_id: check_run.id
})

for (const annotation of annotations.data) {
core.info(`${annotation.path}:${annotation.start_line} - ${annotation.message}`)
if (annotation.annotation_level === 'warning' && annotation.path === '.github') {
// Ignore warning annotations to do with the CI. Likely *-latest upgrade notices
} else {
count += 1
}
for (const annotation of annotations.data) {
let message = `${annotation.path}:${annotation.start_line} - ${annotation.message}`
if (annotation.annotation_level === 'warning' && annotation.path === '.github') {
// Ignore warning annotations to do with the CI. Likely *-latest upgrade notices
message += " (ignored)"
} else {
count += 1
}
core.info(message)
}
core.endGroup()
}

if (count === 0) {
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 145a1e2

Please sign in to comment.