Skip to content

Commit

Permalink
Added entrypoint.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
t-dedah committed Oct 26, 2022
1 parent f032865 commit fa0f960
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Compile files
run: |
ncc build -C -m src/main.ts
ncc build -C -m src/entrypoint.ts
- name: Commit Files
continue-on-error: true # commit will fail if the code wasn't changed. Prevent the build to fail in this case.
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

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": "cli",
"version": "1.0.7",
"description": "Automate your GitHub workflows using Azure CLI scripts.",
"main": "lib/main.js",
"main": "src/main.js",
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
11 changes: 11 additions & 0 deletions src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { setFailed } from '@actions/core';
import { main } from './main';

main()
.then(() => {
process.exit(0)
})
.catch((err: Error) => {
setFailed(err.message);
process.exit(1);
});
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,3 @@ const executeDockerCommand = async (dockerCommand: string, continueOnError: bool
core.warning(errorStream)
}
}

main()
2 changes: 1 addition & 1 deletion test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as core from '@actions/core';
// Unit Tests
export async function runTests() {
try {
let result = await main()
await main()
return 'pass'
} catch (e) {
core.error(JSON.stringify(e))
Expand Down

0 comments on commit fa0f960

Please sign in to comment.