mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
create patch request params with output
This commit is contained in:
parent
cf7f2a70cf
commit
16a69ceefa
2 changed files with 12 additions and 7 deletions
13
src/main.ts
13
src/main.ts
|
|
@ -1,8 +1,7 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {GitHub} from '@actions/github/lib/utils'
|
import {GitHub} from '@actions/github/lib/utils'
|
||||||
import { OctokitResponse } from '@octokit/types'
|
import {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods'
|
||||||
import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods";
|
|
||||||
|
|
||||||
import {ArtifactProvider} from './input-providers/artifact-provider'
|
import {ArtifactProvider} from './input-providers/artifact-provider'
|
||||||
import {LocalFileProvider} from './input-providers/local-file-provider'
|
import {LocalFileProvider} from './input-providers/local-file-provider'
|
||||||
|
|
@ -10,6 +9,7 @@ import {FileContent} from './input-providers/input-provider'
|
||||||
import {ParseOptions, TestParser} from './test-parser'
|
import {ParseOptions, TestParser} from './test-parser'
|
||||||
import {TestRunResult} from './test-results'
|
import {TestRunResult} from './test-results'
|
||||||
import {getAnnotations, Annotation} from './report/get-annotations'
|
import {getAnnotations, Annotation} from './report/get-annotations'
|
||||||
|
import {UpdateChecksParametersWithOutput} from './report/patch-check'
|
||||||
import {getReport} from './report/get-report'
|
import {getReport} from './report/get-report'
|
||||||
|
|
||||||
import {DartJsonParser} from './parsers/dart-json/dart-json-parser'
|
import {DartJsonParser} from './parsers/dart-json/dart-json-parser'
|
||||||
|
|
@ -231,10 +231,10 @@ class TestReporter {
|
||||||
|
|
||||||
private handleAnnotations = async (
|
private handleAnnotations = async (
|
||||||
annotations: Annotation[],
|
annotations: Annotation[],
|
||||||
requestParams: RestEndpointMethodTypes['checks']['update']['parameters']
|
requestParams: UpdateChecksParametersWithOutput
|
||||||
): Promise<Annotation[]> => {
|
): Promise<RestEndpointMethodTypes['checks']['update']['response']> => {
|
||||||
const leftAnnotations = [...annotations]
|
const leftAnnotations = [...annotations]
|
||||||
let response: Promise<RestEndpointMethodTypes['checks']['update']['response']>
|
let response: RestEndpointMethodTypes['checks']['update']['response']
|
||||||
while (leftAnnotations.length > 0) {
|
while (leftAnnotations.length > 0) {
|
||||||
const toProcess = leftAnnotations.splice(0, 50)
|
const toProcess = leftAnnotations.splice(0, 50)
|
||||||
const status = leftAnnotations.length > 0 ? 'in_progress' : 'completed'
|
const status = leftAnnotations.length > 0 ? 'in_progress' : 'completed'
|
||||||
|
|
@ -245,7 +245,7 @@ class TestReporter {
|
||||||
|
|
||||||
private updateAnnotation = async (
|
private updateAnnotation = async (
|
||||||
annotations: Annotation[],
|
annotations: Annotation[],
|
||||||
requestParams: RestEndpointMethodTypes['checks']['update']['parameters']
|
requestParams: UpdateChecksParametersWithOutput
|
||||||
): Promise<RestEndpointMethodTypes['checks']['update']['response']> => {
|
): Promise<RestEndpointMethodTypes['checks']['update']['response']> => {
|
||||||
return await this.octokit.rest.checks.update({
|
return await this.octokit.rest.checks.update({
|
||||||
...requestParams,
|
...requestParams,
|
||||||
|
|
@ -253,5 +253,4 @@ class TestReporter {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
6
src/report/patch-check.ts
Normal file
6
src/report/patch-check.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods'
|
||||||
|
import {Annotation} from './get-annotations'
|
||||||
|
|
||||||
|
export type UpdateChecksParametersWithOutput = RestEndpointMethodTypes['checks']['update']['parameters'] & {
|
||||||
|
output: {title: string; summary: string; annotations: Annotation[]}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue