@smartbear/one-report-publisher
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -56,8 +56,8 @@ "use strict"; | ||
var index_js_1 = require("../../src/index.js"); | ||
var organizationId = core_1.default.getInput('organization-id'); | ||
var token = core_1.default.getInput('token'); | ||
var organizationId = core_1.default.getInput('organization') || process.env.ONE_REPORT_ORGANIZATION; | ||
var token = core_1.default.getInput('token') || process.env.ONE_REPORT_TOKEN; | ||
var baseUrl = core_1.default.getInput('url') || process.env.ONE_REPORT_URL; | ||
var globs = core_1.default.getMultilineInput('reports'); | ||
var maxTime = core_1.default.getInput('max-time'); | ||
var ignoreError = core_1.default.getBooleanInput('ignore-error'); | ||
var baseUrl = core_1.default.getInput('url'); | ||
var zip = core_1.default.getBooleanInput('zip'); | ||
@@ -70,2 +70,8 @@ function main() { | ||
case 0: | ||
if (!organizationId) | ||
throw new Error("Please specify 'organization' or define the ONE_REPORT_ORGANIZATION environment variable"); | ||
if (!token) | ||
throw new Error("Please specify 'token' or define the ONE_REPORT_TOKEN environment variable"); | ||
if (!baseUrl) | ||
throw new Error("Please specify 'url' or define the ONE_REPORT_URL environment variable"); | ||
requestTimeout = maxTime ? +maxTime * 1000 : undefined; | ||
@@ -72,0 +78,0 @@ return [4 /*yield*/, (0, index_js_1.publish)(globs, zip, organizationId, baseUrl, process.env, (0, index_js_1.tokenAuthenticator)(token), requestTimeout)]; |
@@ -55,5 +55,5 @@ #!/usr/bin/env node | ||
var program = new commander_1.Command(); | ||
program.requiredOption('-u, --url <url>', 'OneReport URL'); | ||
program.requiredOption('-o, --organization-id <id>', 'OneReport organization id'); | ||
program.requiredOption('-t, --token <token>', 'OneReport token'); | ||
program.requiredOption('-u, --url <url>', 'OneReport URL. Defaults to $ONE_REPORT_URL', process.env.ONE_REPORT_URL); | ||
program.requiredOption('-o, --organization <id>', 'OneReport organization id. Defaults to $ONE_REPORT_ORGANIZATION', process.env.ONE_REPORT_ORGANIZATION); | ||
program.requiredOption('-t, --token <token>', 'OneReport token. Defaults to $ONE_REPORT_TOKEN', process.env.ONE_REPORT_TOKEN); | ||
program.requiredOption('-r, --reports <glob...>', 'Glob to the files to publish'); | ||
@@ -64,3 +64,3 @@ program.option('-m, --max-time <seconds>', 'Max time for each request'); | ||
program.parse(process.argv); | ||
var _a = program.opts(), organizationId = _a.organizationId, token = _a.token, globs = _a.reports, maxTime = _a.maxTime, ignoreError = _a.ignoreError, baseUrl = _a.url, noZip = _a.noZip; | ||
var _a = program.opts(), organization = _a.organization, token = _a.token, globs = _a.reports, maxTime = _a.maxTime, ignoreError = _a.ignoreError, baseUrl = _a.url, noZip = _a.noZip; | ||
function main() { | ||
@@ -73,7 +73,7 @@ return __awaiter(this, void 0, void 0, function () { | ||
requestTimeout = maxTime ? +maxTime * 1000 : undefined; | ||
return [4 /*yield*/, (0, index_js_1.publish)(globs, !noZip, organizationId, baseUrl, process.env, (0, index_js_1.tokenAuthenticator)(token), requestTimeout)]; | ||
return [4 /*yield*/, (0, index_js_1.publish)(globs, !noZip, organization, baseUrl, process.env, (0, index_js_1.tokenAuthenticator)(token), requestTimeout)]; | ||
case 1: | ||
responseBodies = _a.sent(); | ||
return [2 /*return*/, responseBodies.map(function (body) { | ||
return new url_1.URL("/organization/".concat(organizationId, "/test-cycles/").concat(body.testCycleId), baseUrl).toString(); | ||
return new url_1.URL("/organization/".concat(organization, "/test-cycles/").concat(body.testCycleId), baseUrl).toString(); | ||
})]; | ||
@@ -80,0 +80,0 @@ } |
@@ -13,11 +13,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { publish, tokenAuthenticator } from '../../src/index.js'; | ||
const organizationId = core.getInput('organization-id'); | ||
const token = core.getInput('token'); | ||
const organizationId = core.getInput('organization') || process.env.ONE_REPORT_ORGANIZATION; | ||
const token = core.getInput('token') || process.env.ONE_REPORT_TOKEN; | ||
const baseUrl = core.getInput('url') || process.env.ONE_REPORT_URL; | ||
const globs = core.getMultilineInput('reports'); | ||
const maxTime = core.getInput('max-time'); | ||
const ignoreError = core.getBooleanInput('ignore-error'); | ||
const baseUrl = core.getInput('url'); | ||
const zip = core.getBooleanInput('zip'); | ||
function main() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!organizationId) | ||
throw new Error("Please specify 'organization' or define the ONE_REPORT_ORGANIZATION environment variable"); | ||
if (!token) | ||
throw new Error("Please specify 'token' or define the ONE_REPORT_TOKEN environment variable"); | ||
if (!baseUrl) | ||
throw new Error("Please specify 'url' or define the ONE_REPORT_URL environment variable"); | ||
const requestTimeout = maxTime ? +maxTime * 1000 : undefined; | ||
@@ -24,0 +30,0 @@ const responseBodies = yield publish(globs, zip, organizationId, baseUrl, process.env, tokenAuthenticator(token), requestTimeout); |
@@ -15,5 +15,5 @@ #!/usr/bin/env node | ||
const program = new Command(); | ||
program.requiredOption('-u, --url <url>', 'OneReport URL'); | ||
program.requiredOption('-o, --organization-id <id>', 'OneReport organization id'); | ||
program.requiredOption('-t, --token <token>', 'OneReport token'); | ||
program.requiredOption('-u, --url <url>', 'OneReport URL. Defaults to $ONE_REPORT_URL', process.env.ONE_REPORT_URL); | ||
program.requiredOption('-o, --organization <id>', 'OneReport organization id. Defaults to $ONE_REPORT_ORGANIZATION', process.env.ONE_REPORT_ORGANIZATION); | ||
program.requiredOption('-t, --token <token>', 'OneReport token. Defaults to $ONE_REPORT_TOKEN', process.env.ONE_REPORT_TOKEN); | ||
program.requiredOption('-r, --reports <glob...>', 'Glob to the files to publish'); | ||
@@ -24,8 +24,8 @@ program.option('-m, --max-time <seconds>', 'Max time for each request'); | ||
program.parse(process.argv); | ||
const { organizationId, token, reports: globs, maxTime, ignoreError, url: baseUrl, noZip, } = program.opts(); | ||
const { organization, token, reports: globs, maxTime, ignoreError, url: baseUrl, noZip, } = program.opts(); | ||
function main() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const requestTimeout = maxTime ? +maxTime * 1000 : undefined; | ||
const responseBodies = yield publish(globs, !noZip, organizationId, baseUrl, process.env, tokenAuthenticator(token), requestTimeout); | ||
return responseBodies.map((body) => new URL(`/organization/${organizationId}/test-cycles/${body.testCycleId}`, baseUrl).toString()); | ||
const responseBodies = yield publish(globs, !noZip, organization, baseUrl, process.env, tokenAuthenticator(token), requestTimeout); | ||
return responseBodies.map((body) => new URL(`/organization/${organization}/test-cycles/${body.testCycleId}`, baseUrl).toString()); | ||
}); | ||
@@ -32,0 +32,0 @@ } |
{ | ||
"name": "@smartbear/one-report-publisher", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Publish Test Results to SmartBear OneReport", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -30,6 +30,10 @@ [![Run Tests](https://github.com/SmartBear/one-report-publisher/actions/workflows/test.yaml/badge.svg)](https://github.com/SmartBear/one-report-publisher/actions/workflows/test.yaml) | ||
if: ${{ always() }} | ||
uses: smartbear/one-report-publisher@v0.3.2 | ||
uses: smartbear/one-report-publisher@v0.5.0 | ||
with: | ||
organization-id: F5222E06-BA05-4C82-949A-2FE537B6F59F | ||
# Can be omitted if ONE_REPORT_ORGANIZATION is defined | ||
organization: F5222E06-BA05-4C82-949A-2FE537B6F59F | ||
# Can be omitted if ONE_REPORT_TOKEN is defined | ||
token: ${{ secrets.ONE_REPORT_TOKEN }} | ||
# Can be omitted if ONE_REPORT_URL is defined | ||
url: ${{ env.ONE_REPORT_URL }} | ||
reports: ./reports/**/*.{xml,json,ndjson,zip} | ||
@@ -40,17 +44,2 @@ ``` | ||
## CircleCI | ||
Add a step _after_ all tests have run. You have to make sure the command is running in a docker image that has Node.js | ||
installed (for example [cimg/node](https://circleci.com/developer/images/image/cimg/node)). | ||
```yml | ||
- run: | ||
name: Publish test results to OneReport | ||
command: | | ||
npx @smartbear/one-report-publisher@0.3.2 \ | ||
--organization-id F5222E06-BA05-4C82-949A-2FE537B6F59F \ | ||
--token ${ONE_REPORT_TOKEN} \ | ||
--reports ./reports/**/*.{xml,json,ndjson,zip} | ||
``` | ||
## Command Line Reference | ||
@@ -61,3 +50,3 @@ | ||
``` | ||
npx @smartbear/one-report-publisher@v0.3.2 --help | ||
npx @smartbear/one-report-publisher@v0.5.0 --help | ||
@@ -67,10 +56,10 @@ Usage: one-report-publisher [options] | ||
Options: | ||
-o, --organization-id <id> OneReport organization id | ||
-t, --token <token> OneReport token | ||
-r, --reports <glob...> Glob to the files to publish | ||
-m, --max-time <seconds> Max time for each request | ||
-i, --ignore-error Exit with 0 even if a timeout or error occurred | ||
-u, --url <url> OneReport URL | ||
--no-zip Do not zip non .zip files | ||
-h, --help display help for command | ||
-u, --url <url> OneReport URL. Defaults to $ONE_REPORT_URL | ||
-o, --organization <id> OneReport organization id. Defaults to $ONE_REPORT_ORGANIZATION | ||
-t, --token <token> OneReport token. Defaults to $ONE_REPORT_TOKEN | ||
-r, --reports <glob...> Glob to the files to publish | ||
-m, --max-time <seconds> Max time for each request | ||
-i, --ignore-error Exit with 0 even if a timeout or error occurred | ||
--no-zip Do not zip non .zip files | ||
-h, --help display help for command | ||
``` | ||
@@ -81,6 +70,21 @@ | ||
``` | ||
npx @smartbear/one-report-publisher@0.3.2 \ | ||
--organization-id F5222E06-BA05-4C82-949A-2FE537B6F59F \ | ||
npx @smartbear/one-report-publisher@0.5.0 \ | ||
--organization F5222E06-BA05-4C82-949A-2FE537B6F59F \ | ||
--token ${ONE_REPORT_TOKEN} \ | ||
--reports ./reports/**/*.{xml,json,ndjson,zip} | ||
``` | ||
## CircleCI | ||
Add a step _after_ all tests have run. You have to make sure the command is running in a docker image that has Node.js | ||
installed (for example [cimg/node](https://circleci.com/developer/images/image/cimg/node)). | ||
```yml | ||
- run: | ||
name: Publish test results to OneReport | ||
command: | | ||
npx @smartbear/one-report-publisher@0.5.0 \ | ||
--organization F5222E06-BA05-4C82-949A-2FE537B6F59F \ | ||
--token ${ONE_REPORT_TOKEN} \ | ||
--reports ./reports/**/*.{xml,json,ndjson,zip} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
234330
2360
86
48