Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Node.js v20 for the GitHub Actions Library [MABL-13559] #61

Merged
merged 4 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Separate entrypoint
  • Loading branch information
twistedpair committed May 21, 2024
commit ff5f05f7fd0d15a2ff7e9084c9b9454e12a102a6
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ outputs:

runs:
using: "node20"
main: "lib/src/index.js"
main: "lib/src/entrypoint.js"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mabl-github-deployments-action",
"version": "1.13.1",
"description": "mabl github action for GitHub pipelines integration",
"main": "lib/src/index.js",
"main": "lib/src/entrypoint.js",
"scripts": {
"test": "jest",
"build": "tsc",
Expand Down
5 changes: 5 additions & 0 deletions src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {run} from './index';

// This exists in a separate file, so that we don't implicitly invoke it during unit tests, allowing for overrides
// eslint-disable-next-line
run();
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ export function booleanInput(name: string): boolean {
);
}

export async function run(): Promise<void> {
export async function run(enableFailureExitCodes = true): Promise<void> {
const wrappedFailed = (message: string): void => {
// Allow disabling, otherwise units will always fail in workflow builds w/ process exit code 1
if (process.env.DISABLE_FAILURE_EXIT_CODES !== 'true') {
// core.setFailed(message);
if (enableFailureExitCodes) {
core.setFailed(message);
}
console.log(message);
};

try {
Expand Down Expand Up @@ -300,6 +299,3 @@ async function getRelatedPullRequest(): Promise<Option<PullRequest>> {

return;
}

// eslint-disable-next-line
run();
4 changes: 2 additions & 2 deletions test/suite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ describe('GitHub Action tests', () => {
}

function assertExitCodeNot(expected: number): void {
expect(process.exitCode).not.toEqual(expected);
expect(process.exitCode).not.toBe(expected);
}

it('handles invalid application/environment ids', async () => {
setGithubInput(ActionInputs.ApplicationId, '');
setGithubInput(ActionInputs.EnvironmentId, '');
await run();
await run(false);
assertExitCodeNot(1); // We'd normally seek '1', but that will break the CI/CD test harness
});

Expand Down