Fallback on repository owner instead when rest api fails
This commit is contained in:
4
action/dist/index.js
vendored
4
action/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "metrics",
|
||||
"version": "2.6.0",
|
||||
"version": "2.7.0-beta",
|
||||
"description": "Generate an user's GitHub metrics as SVG image format to embed somewhere else",
|
||||
"main": "index.mjs",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user