auth_travis: Authorize Travis-CI API

Description Usage Arguments Details Value See Also Examples

Description

Initialize a Travis-CI API token

Usage

1
2
3
4
auth_travis(username, password, setenv = TRUE, clean = !missing(username),
  force = FALSE, gh_token = c(Sys.getenv("GITHUB_TOKEN"),
  Sys.getenv("GITHUB_PAT")), base = c("https://api.travis-ci.org",
  "https://api.travis-ci.com"))

Arguments

username

A character string containing a GitHub username.

password

A character string containing a GitHub password for account username.

setenv

A logical indicating whether to set the TRAVIS_CI_TOKEN environment variable. If FALSE, this will have to be passed to all other functions.

clean

A logical specifying whether to delete the temporarily generated GitHub personal access token from the GitHub account. Deafult is TRUE if username is specified. This is ignored if passing a GitHub token directly.

force

A logical indicating whether to force the operation and override an already stored value in TRAVIS_CI_TOKEN.

gh_token

An optional character string specifying a GitHub personal access token. This is ignored if username is supplied.

base

A character string specifying the base URL for the API. By default this is https://api.travis-ci.org, but may need to be changed if using a Travis Pro or enterprise account.

Details

Using the Travis-CI API requires an API token (see API documentation for details). This function implements a sort of handshake that uses a GitHub personal access token to generate a Travis token (to store in an environment variable, TRAVIS_CI_TOKEN) or, alternatively, uses a GitHub username and password pair to generate such a token, conduct the handshake, and then cleanup the generated, temporary token. The easiest way to use the function is to set the GITHUB_TOKEN and GITHUB_PAT environment variables, then simply call auth_travis() with no arguments, but see examples.

Value

A character string containing the Travis-CI API token, invisibly.

See Also

travisHTTP

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# authenticate using GitHub login credentials
auth_travis("username", "password")

# authenticate using a GitHub personal access token
auth_travis(gh_token = "example token")

# set GITHUB_TOKEN environment variable to authenticate
Sys.setenv("GITHUB_TOKEN" = "example token")
auth_travis()

## End(Not run)

cloudyr/travisci documentation built on May 13, 2019, 8:22 p.m.