travis-token-updater
tool for rolling tokens for multiple projects across an account
Table of Contents
Purpose
This tool will scan your GitHub account's repositories for JavaScript projects
and make it simple to update the value of the NPM_TOKEN
or GH_TOKEN
encrypted environment variable on Travis CI for each project.
This is especially useful for an NPM_TOKEN
that is CIDR restricted to work
only on valid Travis CI servers. This restriction depends on the public IP
addresses of those servers, which do change occasionally. When the list changes,
a new token with the proper IPs must be created
and used instead of the previous token that now has an outdated list of IPs.
Usage
Installation
$ npm install travis-token-updater
Authentication
A GitHub personal access token is needed to interaction the the GitHub and Travis CI APIs.
Add a personal access token
to your ~/.netrc
file
machine github.com
login <personal access token here>
Example
Dependencies:
import yargs from 'yargs';
import {update as updateTravisTokens} from 'travis-token-updater';
Register with the framework of your choise (yargs is used here)
yargs
.scriptName('form8ion-utils')
.usage('Usage: $0 <cmd> [args]')
.command(
'travis-tokens',
'Roll token for Travis projects throughout the organization',
() => updateTravisTokens({githubAccount: '<your github account here (optionally)>'})
)
.help('h')
.alias('h', 'help')
.argv;
Contributing
Dependencies
$ nvm install
$ npm install
Verification
$ npm test