catch errors during blob creation for debugging

This commit is contained in:
Peter Evans 2024-08-21 07:43:59 +00:00
parent 1e681e3226
commit a3546365cd
2 changed files with 56 additions and 69 deletions

View file

@ -255,16 +255,23 @@ export class GitHubHelper {
commit.changes.map(async ({path, mode, status}) => {
let sha: string | null = null
if (status === 'A' || status === 'M') {
core.info(`Creating blob for file '${path}'`)
const {data: blob} = await blobCreationLimit(() =>
this.octokit.rest.git.createBlob({
...repository,
content: utils.readFileBase64([repoPath, path]),
encoding: 'base64'
})
)
sha = blob.sha
try {
const {data: blob} = await blobCreationLimit(() =>
this.octokit.rest.git.createBlob({
...repository,
content: utils.readFileBase64([repoPath, path]),
encoding: 'base64'
})
)
sha = blob.sha
} catch (error) {
core.error(
`Error creating blob for file '${path}': ${utils.getErrorMessage(error)}`
)
throw error
}
}
core.info(`Created blob for file '${path}'`)
return <TreeObject>{
path,
mode,