GitHub Apps are the right way to authenticate automation against the GitHub
API: tokens are short-lived, scoped, and not tied to a person. ghapp
generates installation access tokens for them from R.
It reads credentials from environment variables for CI/CD, supports GitHub Enterprise and scoped permissions, and caches tokens until they’re close to expiring.
Sys.setenv(GHAPP_APP_ID = "123456")
Sys.setenv(GHAPP_PRIVATE_KEY_PATH = "~/key.pem")
token <- get_github_app_token()