HttpError: Validation Failed: {"resource":"CheckRun","code":"invalid","field":"annotations"}
hyperair opened this issue · 0 comments
hyperair commented
Describe a bug
The Github action sometimes gets a Validation Failed error while setting
coverage report annotations.
Console output with traceback
Switching back to original branch ended
Begin stages.checkthreshold...
stages.checkThreshold ended
Begin generating report...
Generating report ended
Begin report publish...
Report publish ended
Begin setting outputs...
Setting outputs skipped
Setting outputs ended
Begin failed tests' annotations publication...
Failed tests' annotations publication skipped
Failed tests' annotations publication ended
Begin coverage annotations publication...
Coverage annotations publication failed
Error: HttpError: Validation Failed: {"resource":"CheckRun","code":"invalid","field":"annotations"}
HttpError: Validation Failed: {"resource":"CheckRun","code":"invalid","field":"annotations"}
at /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:8:324068
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2230:16331
at async ei (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2221:158)
at async UD (/home/runner/work/_actions/ArtiomTr/jest-coverage-report-action/v2/dist/index.js:2230:16090)
Coverage annotations publication ended
Error: Jest coverage report action failed
Error: Process completed with exit code 1.
I won't upload the full json report that caused this, but I have narrowed down the issue to inverted column ranges in the coverageMap
:
inverted ranges in coverageMap
% jq '
[
.coverageMap | to_entries | .[] |
.value.statementMap | to_entries | .[] |
select (
.value.start.line == .value.end.line and
.value.start.column != null and
.value.end.column != null and
.value.start.column > .value.end.column
)
] | first
' report.json
{
"key": "63",
"value": {
"start": {
"line": 150,
"column": 40
},
"end": {
"line": 150,
"column": 18
}
}
}
% jq '
[
.coverageMap | to_entries | .[] |
.value.statementMap | to_entries | .[] |
select (
.value.start.line > .value.end.line
)
] | first
' report.json
{
"key": "5",
"value": {
"start": {
"line": 7,
"column": 12
},
"end": {
"line": 6,
"column": 25
}
}
}
Expected behavior
Since jest seems to generate these inverted ranges on its own, jest-coverage-report-action should handle them and massage them into a format that Github will accept.
Details
-
Action version: v2
-
OS, where your action is running (windows, linux): linux
-
action.yml file
```yml - name: Report coverage uses: ArtiomTr/jest-coverage-report-action@v2 with: annotations: failed-tests skip-step: all coverage-file: report.json base-coverage-file: base-report.json threshold: 45 ```