browse_travis_token: Authenticate to Travis

View source: R/travis-auth.R

browse_travis_tokenR Documentation

Authenticate to Travis

Description

A Travis API Key is needed to interact with the Travis API. browse_travis_token() opens a browser window for the respective Travis endpoint. On this site, you can copy your personal API key and then follow the instructions of the console output or the ones shown below.

Usage

browse_travis_token(endpoint = get_endpoint())

Arguments

endpoint

[string]
Which Travis endpoint to use. Defaults to ".org". Accepted values are ".com" and ".org". Can be set globally via env var R_TRAVIS.

Storing the API Key

The travis package supports two ways of storing the Travis API key(s):

  • via env vars R_TRAVIS_ORG and R_TRAVIS_COM

  • via ~/.travis/config.yml

The latter should already be present if you already used the Travis CI CLI tool at some point in the past. However, for simplicity we recommend to use the env var approach.

To store the API key as an env var, add the following to ~/.Renviron and restart R. You only need to store API keys for the Travis endpoint you are using. You can store both if you want.

R_TRAVIS_COM = <your API key here>
R_TRAVIS_ORG = <your API key here>

If you still want to use the config file approach, the following instructions should help to set up ~/.travis/config.yml correctly:

  1. Copy the token from the browser window which just opened. You can use edit_travis_config() to open ~/.travis/config.yml.

  2. The token should be stored using the following structure

    endpoints:
      https://api.travis-ci.<endpoint>/:
        access_token: <token>
    

    with <endpoint> being either 'com' or 'org'.


ropenscilabs/travis documentation built on May 18, 2022, 8:33 p.m.