Add try/catch to retrieve authenticated commiter

This commit is contained in:
lowlighter
2020-12-12 01:31:04 +01:00
parent 31d7c4bec9
commit f9d5773528
2 changed files with 7 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@@ -175,7 +175,12 @@
throw new Error("You must provide a valid GitHub token to commit your metrics")
const rest = github.getOctokit(token)
console.log(`Committer REST API | ok`)
console.log(`Committer | ${(await rest.users.getAuthenticated()).data.login}`)
try {
console.log(`Committer | ${(await rest.users.getAuthenticated()).data.login}`)
}
catch {
console.log(`Committer | (unknown)`)
}
//Retrieve previous render SHA to be able to update file content through API
let sha = null
try {