I might be missing something but I think there's no need to request the GitHub API if both author_name and author_email inputs are set?
|
// #region author_name, author_email |
|
let author = event?.head_commit?.author |
|
if (sha && !author) { |
|
info( |
|
'> Unable to get commit from workflow event: trying with the GitHub API...' |
|
) |
|
|
|
// https://docs.github.com/en/rest/reference/repos#get-a-commit--code-samples |
|
const url = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/commits/${sha}`, |
|
headers = token |
|
? { |
|
Authorization: `Bearer ${token}` |
|
} |
|
: undefined, |
|
commit = ( |
|
await axios.get(url, { headers }).catch((err) => { |
|
startGroup('Request error:') |
|
info(`> Request URL: ${url}\b${err}`) |
|
endGroup() |
|
return undefined |
|
}) |
|
)?.data |
|
|
|
author = commit?.commit?.author |
|
} |
|
|
|
if (author) { |
|
setDefault('author_name', author.name) |
|
setDefault('author_email', author.email) |
|
} |
I might be missing something but I think there's no need to request the GitHub API if both
author_nameandauthor_emailinputs are set?add-and-commit/src/main.ts
Lines 229 to 258 in 941a2d6