Files
unity-test-runner/src/model/action.ts
David Finol cdfccd0aad Refactor to typescript (#158)
* Refactor to typescript

* Fix platform and workflow

* Fix workflow and platform

* Update husky and image-tag

* Use 'yarn lint-staged' instead of 'npx lint-staged'
2022-01-11 05:52:29 -06:00

49 lines
990 B
TypeScript

import path from 'path';
const Action = {
get supportedPlatforms() {
return ['linux'];
},
get isRunningLocally() {
return process.env.RUNNER_WORKSPACE === undefined;
},
get isRunningFromSource() {
return path.basename(__dirname) === 'model';
},
get canonicalName() {
return 'unity-test-runner';
},
get rootFolder() {
if (Action.isRunningFromSource) {
return path.dirname(path.dirname(path.dirname(__filename)));
}
return path.dirname(path.dirname(__filename));
},
get actionFolder() {
return `${Action.rootFolder}/dist`;
},
get dockerfile() {
return `${Action.actionFolder}/Dockerfile`;
},
get workspace() {
return process.env.GITHUB_WORKSPACE;
},
checkCompatibility() {
const currentPlatform = process.platform;
if (!Action.supportedPlatforms.includes(currentPlatform)) {
throw new Error(`Currently ${currentPlatform}-platform is not supported`);
}
},
};
export default Action;