fix: ditch actions-toolkit for outputs
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user