fix: ditch actions-toolkit for outputs

This commit is contained in:
Federico Grandi
2021-05-11 19:37:31 +02:00
parent ea8b2e7ef9
commit 3cbcd603a6
3 changed files with 14 additions and 11 deletions

8
lib/index.js generated

File diff suppressed because one or more lines are too long

View File

@@ -8,10 +8,10 @@ import {
Input,
log,
matchGitArgs,
outputs,
parseBool,
readJSON,
setOutput,
tools
setOutput
} from './util'
const baseDir = path.join(process.cwd(), getInput('cwd') || '')
@@ -449,8 +449,8 @@ function parseInputArray(input: string): string[] {
function logOutputs() {
core.startGroup('Outputs')
for (const key in tools.outputs) {
core.info(`${key}: ${tools.outputs[key]}`)
for (const key in outputs) {
core.info(`${key}: ${outputs[key]}`)
}
core.endGroup()
}

View File

@@ -29,7 +29,7 @@ export const tools = new Toolkit<RecordOf<Input>, RecordOf<Output>>({
'GITHUB_ACTOR'
]
})
tools.outputs = {
export const outputs: Record<Output, 'true' | 'false'> = {
committed: 'false',
pushed: 'false',
tagged: 'false'
@@ -114,8 +114,11 @@ export function readJSON(filePath: string) {
}
}
export function setOutput(name: Output, value: 'true' | 'false') {
export function setOutput<T extends Output>(name: T, value: typeof outputs[T]) {
core.debug(`Setting output: ${name}=${value}`)
tools.outputs[name] = value
outputs[name] = value
core.setOutput(name, value)
}
// Setup default output values
Object.entries(outputs).forEach(([name, value]) => core.setOutput(name, value))