Fallback on repository owner instead when rest api fails

This commit is contained in:
lowlighter
2020-12-12 01:40:39 +01:00
parent f9d5773528
commit 1ef9cd3f6c
3 changed files with 11 additions and 4 deletions

View File

@@ -56,7 +56,14 @@
console.log(`SVG optimization | ${optimize}`)
//GitHub user
const user = core.getInput("user") || (await rest.users.getAuthenticated()).data.login
let authenticated = github.context.repo.owner
try {
authenticated = (await rest.users.getAuthenticated()).data.login
}
catch {
authenticated = github.context.repo.owner
}
const user = core.getInput("user") || authenticated
console.log(`GitHub user | ${user}`)
//Debug mode