Skip to content

Commit bea1946

Browse files
1 parent 50f1c6a commit bea1946

File tree

7 files changed

+46
-8
lines changed

7 files changed

+46
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
node-version: '12.x'
4949
- run: npm ci
5050
- run: npm test
51-
- uses: check-run-reporter/action@v2.10.0
51+
- uses: check-run-reporter/action@v2.10.1
5252
# always run, otherwise you'll only see results for passing builds
5353
if: ${{ always() }}
5454
with:

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ branding:
55
icon: 'check'
66
color: 'orange'
77
inputs:
8+
hostname:
9+
default: api.check-run-reporter.com
10+
description: Internal. Do not use unless directed. Supercedes --url
11+
required: false
812
label:
913
description:
1014
Label that should appear in the GitHub check. Defaults to the step's name.
1115
required: false
1216
nodeCount:
1317
description: The total number of nodes you intend to spin up
18+
required: false
1419
nodeIndex:
1520
description: This node's index.
21+
required: false
1622
report:
1723
description: Path or glob to the job's report files. Separate multiple globs with a semicolon
1824
required: false

dist/index.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36093,7 +36093,16 @@ __nccwpck_require__.r(__webpack_exports__);
3609336093
* Send the full list of available test files and get back the filees
3609436094
* appropriate to this node.
3609536095
*/
36096-
async function split({ tests, label, nodeCount, nodeIndex, token, url }, context) {
36096+
async function split({ hostname, tests, label, nodeCount, nodeIndex, token, url }, context) {
36097+
const u = new URL(url);
36098+
if (hostname !== u.hostname) {
36099+
u.hostname = hostname;
36100+
context.logger.info('Overriding hostname', {
36101+
newUrl: u.href,
36102+
originalUrl: url,
36103+
});
36104+
url = u.href;
36105+
}
3609736106
// This is just here to test the buildkite plugin. The only other option I can
3609836107
// think of is to run a server locally that responds with this and use the
3609936108
// `url` param, but that currently seems like more trouble than its worth for
@@ -36332,7 +36341,7 @@ async function multiStepUpload(args, context) {
3633236341
logger.info(`SHA: ${sha}`);
3633336342
logger.debug(`URL: ${url}/upload`);
3633436343
const filenames = await (0,file/* multiGlob */._)(report, context);
36335-
logger.group('Requesing signed urls');
36344+
logger.group('Requesting signed urls');
3633636345
const { keys, urls, signature } = await getSignedUploadUrls(args, filenames);
3633736346
logger.groupEnd();
3633836347
logger.group('Uploading reports');
@@ -36420,14 +36429,25 @@ async function submit_submit(input, context) {
3642036429
* gets a 404. This _should_ make things future proof so it'll get more
3642136430
* efficient once the new version is released.
3642236431
*/
36423-
async function tryMultiStepUploadOrFallbackToSingle(input, context) {
36432+
async function tryMultiStepUploadOrFallbackToSingle({ hostname, url, ...rest }, context) {
36433+
const u = new URL(url);
36434+
if (hostname !== u.hostname) {
36435+
u.hostname = hostname;
36436+
context.logger.info('Overriding hostname', {
36437+
newUrl: u.href,
36438+
originalUrl: url,
36439+
});
36440+
url = u.href;
36441+
}
36442+
const input = { url, ...rest };
3642436443
try {
3642536444
return await multiStepUpload(input, context);
3642636445
}
3642736446
catch (err) {
3642836447
if (axios_default().isAxiosError(err)) {
3642936448
// CI doesn't like safe-access here.
3643036449
if (err.response && err.response.status === 404) {
36450+
context.logger.info('Falling back to single step upload');
3643136451
// eslint-disable-next-line import/no-deprecated
3643236452
return await singleStepUpload(input, context);
3643336453
}
@@ -36464,7 +36484,7 @@ var axios_default = /*#__PURE__*/__nccwpck_require__.n(axios);
3646436484
var ci_info = __nccwpck_require__(3257);
3646536485
var ci_info_default = /*#__PURE__*/__nccwpck_require__.n(ci_info);
3646636486
;// CONCATENATED MODULE: ../../package.json
36467-
const package_namespaceObject = JSON.parse('{"name":"@check-run-reporter/cli","version":"1.10.0","description":"A GitHub action for uploading structured test reports to > [check-run-reporter.com](https://www.check-run-reporter.com).","bin":{"crr":"./dist/ncc/index.js"},"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","engines":{"node":">=14","npm":">=7"},"scripts":{"build":"if command -v gmake 2>/dev/null; then gmake all; else make all; fi","build:types":"tsc --emitDeclarationOnly","eslint":"eslint ${ESLINT_FORMAT_OPTIONS:-} --ignore-path .gitignore","lint":"npm-run-all --continue-on-error --parallel lint:*","lint:changelog":"commitlint --from origin/main --to HEAD","lint:es":"npm run --silent eslint -- .","prelint:types":"mkdirp reports/style","lint:types":"bash -c \\"tsc --noEmit $TSC_OPTIONS\\" ","test":"TZ=UTC jest","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/check-run-reporter/integrations.git"},"keywords":[],"author":"Ian Remmel, LLC","license":"MIT","bugs":{"url":"https://github.com/check-run-reporter/integrations/issues"},"homepage":"https://www.check-run-reporter.com","devDependencies":{"@babel/cli":"^7.15.7","@babel/core":"^7.16.0","@babel/preset-env":"^7.16.5","@babel/preset-typescript":"^7.15.0","@babel/register":"^7.15.3","@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@ianwremmel/eslint-plugin-ianwremmel":"^4.4.0","@semantic-release/exec":"^6.0.3","@types/glob":"^7.1.4","@types/jest":"^27.0.2","@types/lodash":"^4.14.178","@types/nock":"^11.1.0","@types/node":"^14.17.17","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0","@vercel/ncc":"^0.31.1","babel-jest":"^27.2.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-babel":"^5.3.1","eslint-plugin-compat":"^3.13.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","eslint-plugin-react":"^7.26.0","eslint-plugin-react-hooks":"^4.2.0","husky":"^7.0.4","jest":"^27.2.5","jest-junit":"^13.0.0","lint-staged":"^11.2.0","markdown-toc":"^1.2.0","memfs":"^3.3.0","nock":"^13.1.3","npm-run-all":"^4.1.5","pkg":"^5.3.2","prettier":"^2.4.1","rimraf":"^3.0.2","semantic-release":"^18.0.0","semver":"^7.3.5","typescript":"^4.4.3"},"lint-staged":{"*.js":"npm run eslint -- ","*.ts":"npm run eslint -- "},"dependencies":{"axios":"^0.24.0","axios-retry":"^3.1.9","ci-info":"^3.2.0","form-data":"^4.0.0","glob":"^7.2.0","lodash":"^4.17.21","yargs":"^17.1.1"},"publishConfig":{"access":"public"},"workspaces":["integrations/action"]}');
36487+
const package_namespaceObject = JSON.parse('{"name":"@check-run-reporter/cli","version":"1.10.1","description":"A GitHub action for uploading structured test reports to > [check-run-reporter.com](https://www.check-run-reporter.com).","bin":{"crr":"./dist/ncc/index.js"},"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","engines":{"node":">=14","npm":">=7"},"scripts":{"build":"if command -v gmake 2>/dev/null; then gmake all; else make all; fi","build:types":"tsc --emitDeclarationOnly","eslint":"eslint ${ESLINT_FORMAT_OPTIONS:-} --ignore-path .gitignore","lint":"npm-run-all --continue-on-error --parallel lint:*","lint:changelog":"commitlint --from origin/main --to HEAD","lint:es":"npm run --silent eslint -- .","prelint:types":"mkdirp reports/style","lint:types":"bash -c \\"tsc --noEmit $TSC_OPTIONS\\" ","test":"TZ=UTC jest","prepare":"husky install"},"repository":{"type":"git","url":"git+https://github.com/check-run-reporter/integrations.git"},"keywords":[],"author":"Ian Remmel, LLC","license":"MIT","bugs":{"url":"https://github.com/check-run-reporter/integrations/issues"},"homepage":"https://www.check-run-reporter.com","devDependencies":{"@babel/cli":"^7.15.7","@babel/core":"^7.16.0","@babel/preset-env":"^7.16.5","@babel/preset-typescript":"^7.15.0","@babel/register":"^7.15.3","@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@ianwremmel/eslint-plugin-ianwremmel":"^4.4.0","@semantic-release/exec":"^6.0.3","@types/glob":"^7.1.4","@types/jest":"^27.0.2","@types/lodash":"^4.14.178","@types/nock":"^11.1.0","@types/node":"^14.17.17","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0","@vercel/ncc":"^0.31.1","babel-jest":"^27.2.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-babel":"^5.3.1","eslint-plugin-compat":"^3.13.0","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-import":"^2.24.2","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-markdown":"^2.2.1","eslint-plugin-prettier":"^4.0.0","eslint-plugin-react":"^7.26.0","eslint-plugin-react-hooks":"^4.2.0","husky":"^7.0.4","jest":"^27.2.5","jest-junit":"^13.0.0","lint-staged":"^11.2.0","markdown-toc":"^1.2.0","memfs":"^3.3.0","nock":"^13.1.3","npm-run-all":"^4.1.5","pkg":"^5.3.2","prettier":"^2.4.1","rimraf":"^3.0.2","semantic-release":"^18.0.0","semver":"^7.3.5","typescript":"^4.4.3"},"lint-staged":{"*.js":"npm run eslint -- ","*.ts":"npm run eslint -- "},"dependencies":{"axios":"^0.24.0","axios-retry":"^3.1.9","ci-info":"^3.2.0","form-data":"^4.0.0","glob":"^7.2.0","lodash":"^4.17.21","yargs":"^17.1.1"},"publishConfig":{"access":"public"},"workspaces":["integrations/action"]}');
3646836488
;// CONCATENATED MODULE: ../../src/lib/axios.ts
3646936489

3647036490

@@ -36917,6 +36937,7 @@ async function findReports() {
3691736937
* Wrapper around split to adapt it for github actions
3691836938
*/
3691936939
async function doSplit({
36940+
hostname,
3692036941
label,
3692136942
tests,
3692236943
token,
@@ -36937,6 +36958,7 @@ async function doSplit({
3693736958
const {
3693836959
filenames
3693936960
} = await (0, _split.split)({
36961+
hostname,
3694036962
label,
3694136963
nodeCount: Number(nodeCount),
3694236964
nodeIndex: Number(nodeIndex),
@@ -36971,12 +36993,14 @@ async function main() {
3697136993
// For lack of a better pattern, we'll default to the same pattern that GitHub
3697236994
// uses for checks at the bottom of the PR.
3697336995
const label = core.getInput('label') || `${github.context.workflow} / ${github.context.job}`;
36996+
const hostname = core.getInput('hostname');
3697436997
const token = core.getInput('token');
3697536998
const url = core.getInput('url');
3697636999
const tests = core.getInput('tests');
3697737000

3697837001
if (tests) {
3697937002
return await doSplit({
37003+
hostname,
3698037004
label,
3698137005
tests,
3698237006
token,
@@ -36988,6 +37012,7 @@ async function main() {
3698837012
const files = await findReports();
3698937013
const sha = determineSha();
3699037014
await (0, _src.submit)({
37015+
hostname,
3699137016
label,
3699237017
report: files,
3699337018
root,

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.

dist/src/commands/split.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Context } from '../lib/types';
22
interface SplitArgs {
3+
readonly hostname: string;
34
/** list of filenames or globs that match all available test files */
45
readonly tests: readonly string[];
56
readonly label: string;
@@ -12,5 +13,5 @@ interface SplitArgs {
1213
* Send the full list of available test files and get back the filees
1314
* appropriate to this node.
1415
*/
15-
export declare function split({ tests, label, nodeCount, nodeIndex, token, url }: SplitArgs, context: Context): Promise<any>;
16+
export declare function split({ hostname, tests, label, nodeCount, nodeIndex, token, url }: SplitArgs, context: Context): Promise<any>;
1617
export {};

dist/src/commands/submit.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Context, Optional } from '../lib/types';
22
interface SubmitArgs {
3+
readonly hostname: string;
34
readonly label: Optional<string>;
45
readonly report: readonly string[];
56
readonly root: string;

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export async function findReports(): Promise<string[]> {
8888
}
8989

9090
interface DoSplitInput {
91+
readonly hostname: string;
9192
readonly label: string;
9293
readonly tests: string;
9394
readonly token: string;
@@ -97,7 +98,7 @@ interface DoSplitInput {
9798
/**
9899
* Wrapper around split to adapt it for github actions
99100
*/
100-
async function doSplit({label, tests, token, url}: DoSplitInput) {
101+
async function doSplit({hostname, label, tests, token, url}: DoSplitInput) {
101102
const nodeCount = core.getInput('nodeCount');
102103
const nodeIndex = core.getInput('nodeIndex');
103104

@@ -112,6 +113,7 @@ async function doSplit({label, tests, token, url}: DoSplitInput) {
112113
try {
113114
const {filenames} = await split(
114115
{
116+
hostname,
115117
label,
116118
nodeCount: Number(nodeCount),
117119
nodeIndex: Number(nodeIndex),
@@ -151,12 +153,14 @@ async function main() {
151153
core.getInput('label') ||
152154
`${github.context.workflow} / ${github.context.job}`;
153155

156+
const hostname = core.getInput('hostname');
154157
const token = core.getInput('token');
155158
const url = core.getInput('url');
156159

157160
const tests = core.getInput('tests');
158161
if (tests) {
159162
return await doSplit({
163+
hostname,
160164
label,
161165
tests,
162166
token,
@@ -171,6 +175,7 @@ async function main() {
171175

172176
await submit(
173177
{
178+
hostname,
174179
label,
175180
report: files,
176181
root,

0 commit comments

Comments
 (0)