gradle-build-action/src/repository-layout.ts
daz 07023d3e3e
Refactor input parameters
Moved reading of all input parameters into a common source: `input-params.ts`.
This centralized all input parameter reads, and allowed an improved implementation
of reading boolean parameters. In particular, the implementation now provides a default
value for a boolean input parameter that isn't declared for an action.
2023-06-06 10:47:56 -06:00

17 lines
558 B
TypeScript

import * as params from './input-params'
import * as path from 'path'
export function workspaceDirectory(): string {
return process.env[`GITHUB_WORKSPACE`] || ''
}
export function buildRootDirectory(): string {
const baseDirectory = workspaceDirectory()
const buildRootDirectoryInput = params.getBuildRootDirectory()
const resolvedBuildRootDirectory =
buildRootDirectoryInput === ''
? path.resolve(baseDirectory)
: path.resolve(baseDirectory, buildRootDirectoryInput)
return resolvedBuildRootDirectory
}