Skip to content

Instantly share code, notes, and snippets.

@topheman
Created August 4, 2015 18:49
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save topheman/25241e48a1b4f91ec6d4 to your computer and use it in GitHub Desktop.
Save topheman/25241e48a1b4f91ec6d4 to your computer and use it in GitHub Desktop.
Travis setup of Github token for jspm

If you encounter the following:

GitHub rate limit reached. To increase the limit use GitHub authentication.
     Run jspm endpoint config github to set this up.

Sources :

  1. go to https://github.com/settings/tokens

  2. Create a token , label it "Travis"

  3. Copy paste the token

  4. jspm registry config github

You'll be asked for the token

  1. jspm registry export github

outputs:

jspm config registries.github.remote https://github.jspm.io
jspm config registries.github.auth JSPM_GITHUB_AUTH_TOKEN
jspm config registries.github.maxRepoSize 100
jspm config registries.github.handler jspm-github

JSPM_GITHUB_AUTH_TOKEN: unencrypted Base64 encoding of your GitHub username and password or access token

  1. Install travis-cli
$ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]
$ gem install travis -v 1.8.0 --no-rdoc --no-ri
$ travis version
1.8.0
  1. Go to the root of your repo, encrypt the token your JSPM_GITHUB_AUTH_TOKEN
travis encrypt 'JSPM_GITHUB_AUTH_TOKEN=[JSPM_GITHUB_AUTH_TOKEN]'

outputs your ENCRYPTED_STRING

  1. Include in your .travis.yml
env:
  global:
  - secure: [ENCRYPTED_STRING]

before_install:
- npm install -g jspm
- jspm config registries.github.auth $JSPM_GITHUB_AUTH_TOKEN
  1. Optional

nano ~/.jspm/config

remove the registries.github part so that the token will only be used by Travis (not by you).

@danielabar
Copy link

Thank you so much for this explanation, it works perfectly.

--add will update travis.yml automatically with the secure setting:

travis encrypt 'JSPM_GITHUB_AUTH_TOKEN=[JSPM_GITHUB_AUTH_TOKEN]' --add

(although still have to add the jspm config section manually)

@davinkevin
Copy link

If you still having problem, verify you didn't use your GITHUB_TOKEN as your JSPM_GITHUB_AUTH_TOKEN... both aren't the same.

@schorfES
Copy link

schorfES commented Nov 6, 2015

Thank you for this guide!!! <3

Instead of placing the JSPM_GITHUB_AUTH_TOKEN as encrypted key in the config, you can skip step 6 and 7 and place them in the project settings on the travis-website under "Environment Variables". See: http://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings

@davinkevin
Copy link

But don't forget (and correct me if I'm wrong), the token will only be used by master and branch from repository, not by Pull Request... because it's sensitive data

@thomaslundstrom
Copy link

FWIW, this also works if using AppVeyor instead of Travis.

@trungie
Copy link

trungie commented May 24, 2016

If anyone is getting 404 errors, don't forget to check public_repo scope when you create your github key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment