Add commit_sha output (#275)
* feat: add commit_sha output * docs(README): add docs for commit_sha
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import path from 'path'
|
||||
import simpleGit, { Response } from 'simple-git'
|
||||
import simpleGit, { CommitSummary, Response } from 'simple-git'
|
||||
import YAML from 'js-yaml'
|
||||
import {
|
||||
getInput,
|
||||
@@ -85,8 +85,11 @@ core.info(`Running in ${baseDir}`)
|
||||
}
|
||||
: {})
|
||||
},
|
||||
(err, data?) => {
|
||||
if (data) setOutput('committed', 'true')
|
||||
(err, data?: CommitSummary) => {
|
||||
if (data) {
|
||||
setOutput('committed', 'true')
|
||||
setOutput('commit_sha', data.commit)
|
||||
}
|
||||
return log(err, data)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ export type Input =
|
||||
| 'tag'
|
||||
| 'github_token'
|
||||
|
||||
export type Output = 'committed' | 'pushed' | 'tagged'
|
||||
export type Output = 'committed' | 'commit_sha' | 'pushed' | 'tagged'
|
||||
|
||||
type RecordOf<T extends string> = Record<T, string | undefined>
|
||||
export const tools = new Toolkit<RecordOf<Input>, RecordOf<Output>>({
|
||||
@@ -31,8 +31,9 @@ export const tools = new Toolkit<RecordOf<Input>, RecordOf<Output>>({
|
||||
'GITHUB_ACTOR'
|
||||
]
|
||||
})
|
||||
export const outputs: Record<Output, 'true' | 'false'> = {
|
||||
export const outputs: Record<Output, any> = {
|
||||
committed: 'false',
|
||||
commit_sha: undefined,
|
||||
pushed: 'false',
|
||||
tagged: 'false'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user