Skip to content

Commit a1c2e34

Browse files
committed
Add annotations via console
1 parent 0c1b2a3 commit a1c2e34

4 files changed

Lines changed: 10 additions & 74 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"project": "./tsconfig.json"
99
},
1010
"rules": {
11+
"no-console": "off",
1112
"i18n-text/no-en": "off",
1213
"eslint-comments/no-use": "off",
1314
"import/no-namespace": "off",

dist/index.js

Lines changed: 3 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

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/utils/github.ts

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -53,49 +53,12 @@ export class GithubUtil {
5353
if (input.annotations.length === 0) {
5454
return 0
5555
}
56-
// github API lets you post 50 annotations at a time
57-
const chunkSize = 50
58-
const chunks: Annotations[][] = []
59-
for (let i = 0; i < input.annotations.length; i += chunkSize) {
60-
chunks.push(input.annotations.slice(i, i + chunkSize))
56+
for (const ann of input.annotations) {
57+
console.log(
58+
`::warning file=${ann.path},line=${ann.start_line},endLine=${ann.end_line}::${ann.message}`
59+
)
6160
}
62-
let lastResponseStatus = 0
63-
let checkId
64-
for (let i = 0; i < chunks.length; i++) {
65-
let status = 'in_progress'
66-
let conclusion = ''
67-
if (i === chunks.length - 1) {
68-
status = 'completed'
69-
conclusion = 'success'
70-
}
71-
const params = {
72-
...github.context.repo,
73-
name: 'Annotate',
74-
head_sha: input.referenceCommitHash,
75-
status,
76-
...(conclusion && {conclusion}),
77-
output: {
78-
title: 'Coverage Tool',
79-
summary: 'Missing Coverage',
80-
annotations: chunks[i]
81-
}
82-
}
83-
let response
84-
if (i === 0) {
85-
response = await this.client.rest.checks.create({
86-
...params
87-
})
88-
checkId = response.data.id
89-
} else {
90-
response = await this.client.rest.checks.update({
91-
...params,
92-
check_run_id: checkId
93-
})
94-
}
95-
core.info(response.data.output.annotations_url)
96-
lastResponseStatus = response.status
97-
}
98-
return lastResponseStatus
61+
return 0
9962
}
10063

10164
buildAnnotations(

0 commit comments

Comments
 (0)