travis_get_vars: Travis CI variables

Description Usage Arguments Details Examples

View source: R/travis-vars.R

Description

Functions around public and private variables available in Travis CI builds.

travis_get_vars() calls the "/settings/env_vars" API.

travis_get_var_id() retrieves the ID for a variable name, or NULL. If multiple variables exist by that name, it returns the ID of the last (with a warning), because this is what seems to be used in Travis CI builds in such a case.

travis_set_var() creates or updates a variable. If multiple variables exist by that name, it updates the last (with a warning), because this is what seems to be used in Travis CI builds in such a case.

travis_delete_var() deletes a variable.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
travis_get_vars(repo = github_repo(), token = travis_token(repo))

travis_get_var_id(name, repo = github_repo(),
  token = travis_token(repo))

travis_set_var(name, value, public = FALSE, repo = github_repo(),
  token = travis_token(repo), quiet = FALSE)

travis_delete_var(name, repo = github_repo(),
  token = travis_token(repo), id = travis_get_var_id(name, repo = repo,
  token = token), quiet = FALSE)

Arguments

repo

[string|numeric]
The GitHub repo slug, by default obtained through github_repo(). Alternatively, the Travis CI repo ID, e.g. obtained through travis_repo_id().

token

[Token2.0]
A Travis CI token obtained from travis_token() or auth_travis().

name

[string]
The name of the variable.

value

[string]
The value for the new or updated variable.

public

[flag]
Should the variable be public or private?

quiet

[flag]
Set to FALSE to suppress success message.

id

[string]
The ID of the variable, by default obtained from travis_get_var_id().

Details

Avoid using travis_set_var() with literal values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
# List all variables:
travis_get_vars()

## End(Not run)
## Not run: 
# Get the ID of a variable.
travis_get_var_id("secret_var")

## End(Not run)
## Not run: 
# Avoid calling with literal values:
travis_set_var("secret_var", "oh no - this will be recorded in .Rhistory!")

# Set a Travis environment variable without recording it in history
# by reading the value from the console:
travis_set_var("secret_var", readLines(n = 1))

## End(Not run)
## Not run: 
# Delete a variable:
travis_delete_var("secret_var")

## End(Not run)

romainfrancois/travis documentation built on May 27, 2019, 1:49 p.m.