Skip to content

Commit

Permalink
feat: ensure repo/workflow/user:email scopes are enabled for github P…
Browse files Browse the repository at this point in the history
…AT in use
  • Loading branch information
js2264 committed Nov 7, 2023
1 parent 41a9fb3 commit 2ce4774
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ init <- function(
}
)
gh_scopes <- gh::gh_whoami(.token = PAT)$scopes
for (scope in c("repo", "workflow", "user:email")) {
for (scope in c("repo", "workflow")) {
if (!grepl(scope, gh_scopes))
cli::cli_abort("The provided PAT does not authorize the `{scope}` scope. Please change the PAT settings @ https://github.com/settings/tokens to enable this scope.\n")
}
if (!grepl("user:email|user", gh_scopes))
cli::cli_abort("The provided PAT does not authorize the `user:email` scope. Please change the PAT settings @ https://github.com/settings/tokens to enable this scope.\n")
gh_user <- gh::gh_whoami(.token = PAT)$login
cli::cli_alert_success(cli::col_grey("Successfully logged in Github"))
cli::cli_ul(c(
Expand Down

0 comments on commit 2ce4774

Please sign in to comment.