Skip to content

Commit

Permalink
v1.14 release
Browse files Browse the repository at this point in the history
  • Loading branch information
twistedpair committed May 21, 2024
1 parent a4ced2f commit 491152e
Show file tree
Hide file tree
Showing 703 changed files with 399,841 additions and 42,494 deletions.
4 changes: 4 additions & 0 deletions lib/src/entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
(0, index_1.run)();
16 changes: 10 additions & 6 deletions lib/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ function booleanInput(name) {
.toLowerCase() === 'true');
}
exports.booleanInput = booleanInput;
async function run() {
async function run(enableFailureExitCodes = true) {
const wrappedFailed = (message) => {
if (enableFailureExitCodes) {
core.setFailed(message);
}
};
try {
core.startGroup('Gathering inputs');
const applicationId = optionalInput(constants_1.ActionInputs.ApplicationId);
const environmentId = optionalInput(constants_1.ActionInputs.EnvironmentId);
const apiKey = process.env.MABL_API_KEY;
if (!apiKey) {
core.setFailed('env var MABL_API_KEY required');
wrappedFailed('env var MABL_API_KEY required');
return;
}
const planLabels = optionalArrayInput(constants_1.ActionInputs.PlanLabels);
Expand Down Expand Up @@ -132,7 +137,7 @@ async function run() {
appOrEnv = await apiClient.getEnvironment(environmentId);
}
if (!appOrEnv) {
core.setFailed('Invalid configuration. Valid "application-id" or "environment-id" must be set. No tests started.');
wrappedFailed('Invalid configuration. Valid "application-id" or "environment-id" must be set. No tests started.');
return;
}
const outputLink = `${baseAppUrl}/workspaces/${appOrEnv.organization_id}/events/${deployment.id}`;
Expand Down Expand Up @@ -172,12 +177,12 @@ async function run() {
core.warning(`There were ${finalExecutionResult.journey_execution_metrics.failed} test failures but the continueOnPlanFailure flag is set so the task has been marked as passing`);
}
else {
core.setFailed(`${finalExecutionResult.journey_execution_metrics.failed} mabl test(s) failed`);
wrappedFailed(`${finalExecutionResult.journey_execution_metrics.failed} mabl test(s) failed`);
}
core.endGroup();
}
catch (err) {
core.setFailed(`mabl deployment task failed for the following reason: ${err}`);
wrappedFailed(`mabl deployment task failed for the following reason: ${err}`);
}
}
exports.run = run;
Expand Down Expand Up @@ -224,4 +229,3 @@ async function getRelatedPullRequest() {
}
return;
}
run();
22 changes: 14 additions & 8 deletions lib/test/suite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
const mablApiClient_1 = require("../src/mablApiClient");
const src_1 = require("../src");
const constants_1 = require("../src/constants");
const axios_1 = require("axios");
describe('GitHub Action tests', () => {
beforeEach(() => {
process.env.DISABLE_FAILURE_EXIT_CODES = 'true';
});
function setGithubInput(name, value) {
process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] = value;
}
function assertExitCode(expected) {
expect(process.exitCode).toEqual(expected);
function assertExitCodeNot(expected) {
expect(process.exitCode).not.toBe(expected);
}
it('handles invalid application/environment ids', async () => {
setGithubInput(constants_1.ActionInputs.ApplicationId, '');
setGithubInput(constants_1.ActionInputs.EnvironmentId, '');
await (0, src_1.run)();
assertExitCode(1);
await (0, src_1.run)(false);
assertExitCodeNot(1);
});
it('parses array inputs', () => {
setGithubInput(constants_1.ActionInputs.BrowserTypes, '');
Expand Down Expand Up @@ -52,7 +56,7 @@ describe('GitHub Action tests', () => {
expect(() => mablApiClient_1.MablApiClient.throwHumanizedError({
status: 403,
statusText: 'This is an error',
config: {},
config: { headers: new axios_1.AxiosHeaders() },
headers: {},
data: 10,
request: {}
Expand All @@ -62,7 +66,7 @@ describe('GitHub Action tests', () => {
expect(() => mablApiClient_1.MablApiClient.throwHumanizedError({
status: 401,
statusText: 'This is an error',
config: {},
config: { headers: new axios_1.AxiosHeaders() },
headers: {},
data: 10,
request: {}
Expand All @@ -72,7 +76,7 @@ describe('GitHub Action tests', () => {
expect(() => mablApiClient_1.MablApiClient.throwHumanizedError({
status: 404,
statusText: 'This is an error',
config: {},
config: { headers: new axios_1.AxiosHeaders() },
headers: {},
data: 10,
request: {}
Expand All @@ -82,7 +86,9 @@ describe('GitHub Action tests', () => {
expect(() => mablApiClient_1.MablApiClient.throwHumanizedError({
status: 500,
statusText: 'This is an error',
config: {},
config: {
headers: new axios_1.AxiosHeaders()
},
headers: {},
data: 10,
request: {}
Expand Down
4 changes: 2 additions & 2 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions node_modules/@actions/core/lib/core.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/oidc-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/oidc-utils.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions node_modules/@actions/core/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions node_modules/@actions/github/lib/context.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/github/lib/context.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions node_modules/@actions/github/lib/github.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/github/lib/github.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions node_modules/@actions/github/lib/internal/utils.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 491152e

Please sign in to comment.