travis-token-updater

1.6.14 • Public • Published

travis-token-updater

tool for rolling tokens for multiple projects across an account

Codecov Node CI Workflow Status

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.

⚠️ This package provides only the programmatic API that enables rolling the tokens on Travis CI, but is expected to be run interactively. You are expected to provide your own CLI wrapper.

Usage

npm MIT license

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

Conventional Commits Commitizen friendly semantic-release PRs Welcome Greenkeeper badge

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

Readme

Keywords

none

Package Sidebar

Install

npm i travis-token-updater

Weekly Downloads

2

Version

1.6.14

License

MIT

Unpacked Size

63.3 kB

Total Files

7

Last publish

Collaborators

  • travi