fix: ditch actions-toolkit for outputs
This commit is contained in:
8
lib/index.js
generated
8
lib/index.js
generated
File diff suppressed because one or more lines are too long
@@ -8,10 +8,10 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
log,
|
log,
|
||||||
matchGitArgs,
|
matchGitArgs,
|
||||||
|
outputs,
|
||||||
parseBool,
|
parseBool,
|
||||||
readJSON,
|
readJSON,
|
||||||
setOutput,
|
setOutput
|
||||||
tools
|
|
||||||
} from './util'
|
} from './util'
|
||||||
|
|
||||||
const baseDir = path.join(process.cwd(), getInput('cwd') || '')
|
const baseDir = path.join(process.cwd(), getInput('cwd') || '')
|
||||||
@@ -449,8 +449,8 @@ function parseInputArray(input: string): string[] {
|
|||||||
|
|
||||||
function logOutputs() {
|
function logOutputs() {
|
||||||
core.startGroup('Outputs')
|
core.startGroup('Outputs')
|
||||||
for (const key in tools.outputs) {
|
for (const key in outputs) {
|
||||||
core.info(`${key}: ${tools.outputs[key]}`)
|
core.info(`${key}: ${outputs[key]}`)
|
||||||
}
|
}
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const tools = new Toolkit<RecordOf<Input>, RecordOf<Output>>({
|
|||||||
'GITHUB_ACTOR'
|
'GITHUB_ACTOR'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
tools.outputs = {
|
export const outputs: Record<Output, 'true' | 'false'> = {
|
||||||
committed: 'false',
|
committed: 'false',
|
||||||
pushed: 'false',
|
pushed: 'false',
|
||||||
tagged: '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}`)
|
core.debug(`Setting output: ${name}=${value}`)
|
||||||
tools.outputs[name] = value
|
outputs[name] = value
|
||||||
core.setOutput(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