@@ -11,15 +11,17 @@ try {
|
|||||||
|
|
||||||
function checkInputs() {
|
function checkInputs() {
|
||||||
const eventPath = process.env.GITHUB_EVENT_PATH
|
const eventPath = process.env.GITHUB_EVENT_PATH
|
||||||
if (eventPath) {
|
const author = eventPath && require(eventPath)?.head_commit?.author
|
||||||
const { author } = require(eventPath).head_commit
|
|
||||||
|
if (author) {
|
||||||
setDefault('author_name', author.name)
|
setDefault('author_name', author.name)
|
||||||
setDefault('author_email', author.email)
|
setDefault('author_email', author.email)
|
||||||
} else {
|
} else {
|
||||||
warning('No event path available, unable to fetch author info.')
|
warning(`Unable to fetch author info: couldn't find ${!eventPath ? 'event path' : !require(eventPath)?.head_commit ? 'commit' : 'commit author'}.`)
|
||||||
setDefault('author_name', 'Add & Commit Action')
|
setDefault('author_name', 'Add & Commit Action')
|
||||||
setDefault('author_email', 'actions@github.com')
|
setDefault('author_email', 'actions@github.com')
|
||||||
}
|
}
|
||||||
|
|
||||||
info(`Using '${getInput('author_name')} <${getInput('author_email')}>' as author.`)
|
info(`Using '${getInput('author_name')} <${getInput('author_email')}>' as author.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user