mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
only master
This commit is contained in:
parent
4e0b3d36b7
commit
3db4c0f8a2
2 changed files with 11 additions and 7 deletions
|
|
@ -233,7 +233,7 @@ class TestReporter {
|
||||||
core.setOutput('url', resp.data.url)
|
core.setOutput('url', resp.data.url)
|
||||||
core.setOutput('url_html', resp.data.html_url)
|
core.setOutput('url_html', resp.data.html_url)
|
||||||
|
|
||||||
if (isFailed && this.slackWebhook) {
|
if (isFailed && this.slackWebhook && this.context.branch === 'master') {
|
||||||
const webhook = new IncomingWebhook(this.slackWebhook)
|
const webhook = new IncomingWebhook(this.slackWebhook)
|
||||||
const passed = results.reduce((sum, tr) => sum + tr.passed, 0)
|
const passed = results.reduce((sum, tr) => sum + tr.passed, 0)
|
||||||
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0)
|
const skipped = results.reduce((sum, tr) => sum + tr.skipped, 0)
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,16 @@ import {createWriteStream} from 'fs'
|
||||||
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 type {PullRequest} from '@octokit/webhooks-types'
|
|
||||||
import * as stream from 'stream'
|
import * as stream from 'stream'
|
||||||
import {promisify} from 'util'
|
import {promisify} from 'util'
|
||||||
import got from 'got'
|
import got from 'got'
|
||||||
const asyncStream = promisify(stream.pipeline)
|
const asyncStream = promisify(stream.pipeline)
|
||||||
|
|
||||||
export function getCheckRunContext(): {sha: string; runId: number} {
|
export function getCheckRunContext(): {sha: string; runId: number; branch: string} {
|
||||||
|
let branch = github.context.ref
|
||||||
|
if (branch.startsWith('refs/heads')) branch = branch.slice(11)
|
||||||
|
core.info('Branch: ' + branch)
|
||||||
|
|
||||||
if (github.context.eventName === 'workflow_run') {
|
if (github.context.eventName === 'workflow_run') {
|
||||||
core.info('Action was triggered by workflow_run: using SHA and RUN_ID from triggering workflow')
|
core.info('Action was triggered by workflow_run: using SHA and RUN_ID from triggering workflow')
|
||||||
const event = github.context.payload
|
const event = github.context.payload
|
||||||
|
|
@ -17,18 +20,19 @@ export function getCheckRunContext(): {sha: string; runId: number} {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
sha: event.workflow_run.head_commit.id,
|
sha: event.workflow_run.head_commit.id,
|
||||||
runId: event.workflow_run.id
|
runId: event.workflow_run.id,
|
||||||
|
branch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const runId = github.context.runId
|
const runId = github.context.runId
|
||||||
if (github.context.payload.pull_request) {
|
if (github.context.payload.pull_request) {
|
||||||
core.info(`Action was triggered by ${github.context.eventName}: using SHA from head of source branch`)
|
core.info(`Action was triggered by ${github.context.eventName}: using SHA from head of source branch`)
|
||||||
const pr = github.context.payload.pull_request as PullRequest
|
const pr = github.context.payload.pull_request;
|
||||||
return {sha: pr.head.sha, runId}
|
return {sha: pr.head.sha, runId, branch}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {sha: github.context.sha, runId}
|
return {sha: github.context.sha, runId, branch}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function downloadArtifact(
|
export async function downloadArtifact(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue