pwmckenna / node-travis-ci Goto Github PK
View Code? Open in Web Editor NEWnode library to access the Travis-CI API
Home Page: https://npmjs.org/package/travis-ci
node library to access the Travis-CI API
Home Page: https://npmjs.org/package/travis-ci
This is an enhancements.
During npm install, receiving following warning:
deprecated [email protected]: Use uuid module instead
Could you please upgrade the module, looks like it could be upgraded.
Sample code says:
travis.requests({
build_id: BUILD_ID
}, function (err, res) {
// res => {
// "result": true,
// "flash": [
// {
// "notice": "The build was successfully restarted."
// }
// ]
// }
});
But should be:
travis.requests.post({
Is it possible to query a single branch using the library? The Travis CI docs describe this as 'Show Branch' as opposed to 'List Branches'. I couldn't figure out how to call it and don't see this endpoint listed in routes.json, but it could also be that I don't grok the API convention. Any help would be appreciated.
Thanks,
Kevin
I would like to filter a list of builds
http://docs.travis-ci.com/api/?http#builds
for example
$ curl https://api.travis-ci.org/repos/angular/angular.dart/builds?event_type=push
it seems that your library doesn't ever pass through a querystring (qs key) to the request library, so there is no way to use these parts of the travis API.
Or am I missing something?
Thanks!
I finally solved an issue that wasted far more time than it should have, considering how simple the fix was. It turns out that I had never logged into travis-pro with the account that the github token was tied to, so I had never granted the travis-pro app access to that github account. Had the .authenticate()
call failed due to the lack of required permissions, as the readme suggests that it would, I hope that I would have narrowed in on the problem sooner.
Authentication is simply a convenience function that ensures your token has the required permissions, then appends your access_token to all subsequent requests.
For context, I was trying to configure semantic-release to work with travis-pro and was getting {file: 'not found'}
responses. These responses were because the access token did not give the account the necessary access to the travis-pro api. Tokens from other accounts that had the same github scopes (repo
) worked just fine. Once I logged into travis-pro with this account and granted travis-pro access to that account, the token started working with no other changes.
Also worth noting is the fact that we still have never logged into the public travis instance (travis-ci.org), but have been successful with the semantic-release process for public repos. This appears to be a difference in behavior between the apis for public travis vs travis-pro.
Would it be possible to detect this scenario and fail the .authenticate()
step? If not, it may help someone in the future to at least update the protip in the readme to make it clear that it doesnt fully "ensures your token has the required permissions", highlighting this case.
I'm trying to use this library for the first time and really struggling to get past the authentication stage. Both CLI and the library is failing.
$ travis-ci auth github --github_token=123
auth not found
const Travis = require("travis-ci");
const GITHUB_OAUTH_TOKEN = "123";
const travis = new Travis({
pro: true,
version: "2.0.0",
});
travis.authenticate({
github_token: GITHUB_OAUTH_TOKEN,
}, (err) => {
console.log("yippe");
});
$ node travis.js
/Users/simon.males/Development/villagepeopleapi/node_modules/travis-ci/lib/travis-ci.js:118
this.auth.github.post(msg, function (err, res) {
^
TypeError: Cannot read property 'github' of undefined
at TravisClient._authenticateGithubToken (/Users/simon.males/Development/villagepeopleapi/node_modules/travis-ci/lib/travis-ci.js:118:14)
at TravisClient.authenticate (/Users/simon.males/Development/villagepeopleapi/node_modules/travis-ci/lib/travis-ci.js:181:21)
at Object.<anonymous> (/Users/simon.males/Development/villagepeopleapi/travis.js:9:8)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
Specifically, this.auth
is not defined anywhere in the application.
Hello,
maybe first a little bit of background.
I tried to use this function
travis.authenticate({
username: GITHUB_USERNAME,
password: GITHUB_PASSWORD
}, function (err) {
//we've authenticated!
});
and it only returned Not a Travis user
- not very descriptive error BTW.
I checked how this code works, tried to duplicate its functionality cause I thought there is something I did wrong
BUT
there is a line
this._authenticateGithubToken({
github_token: app.token
}, callback);
According to this article GitHub API doesn't return token anymore in response.
So, my thinking - this method doesn't work anymore.
Am I right or there is something I missed?
This package depends on request v2.22.0, using ~
- this version is using a couple of dependencies that have security advisories on them. Could you update it to use ^2.74.0
, and publish an updated version?
Request is very bloated - https://bundlephobia.com/[email protected]
Can possibly replace with https://bundlephobia.com/[email protected] or https://bundlephobia.com/[email protected] or something similar?
Hi!
I'm looking into using this project for communicating with a enterprise instance of Travis and it seems like there is no support for this currently. I'm wondering if a PR that adds this would be accepted and if there is any thoughts about how the API should look.
I have done some tests and it seems like this module works great as long as the endpoint is correct, as documented on Travis CI.
Travis CI account | Endpoint |
---|---|
open source projects on travis-ci.org | https://api.travis-ci.org |
private projects on travis-ci.com | https://api.travis-ci.com |
enterprise projects running on a custom domain | https://travis.example.com/api |
My suggestion is to add an additional option to the constructor that takes a Travis CI Enterprise instance location; enterprise
.
Example
var Travis = require('travis-ci');
// To access the Travis-CI Enterprise API
var travis = new Travis({
version: '2.0.0',
enterprise: 'https://travis.example.com'
});
$ npm install -g travis-ci
/Users/balupton/.nvm/versions/io.js/v3.0.0/bin/travis-ci -> /Users/balupton/.nvm/versions/io.js/v3.0.0/lib/node_modules/travis-ci/bin/travis-ci.js
npm WARN unmet dependency /Users/balupton/.nvm/versions/io.js/v3.0.0/lib/node_modules/docpad/node_modules/projectz/node_modules/getcontributors/node_modules/feedr requires safeps@'^4.0.0' but will load
npm WARN unmet dependency /Users/balupton/.nvm/versions/io.js/v3.0.0/lib/node_modules/docpad/node_modules/safeps,
npm WARN unmet dependency which is version 5.1.0
[email protected] /Users/balupton/.nvm/versions/io.js/v3.0.0/lib/node_modules/travis-ci
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
$ travis-ci
func.call is not a function
$ travis-ci help
help not found
$ travis-ci --help
func.call is not a function
$ travis-ci auth github --github_token=$GITHUB_TRAVIS_TOKEN
func.call is not a function
I would love to accept your pull request on travis-ping, but its not working for my account - the token isn't found. =[
in travis-ci.js, the response you are listening for seems a lot different from the response I am getting back on my account.
{ id: 726032,
url: 'https://api.github.com/authorizations/726032',
app:
{ name: 'Travis',
url: 'https://travis-ci.org',
client_id: (hash) },
token: (hash),
note: null,
note_url: null,
created_at: '2012-10-15T17:17:49Z',
updated_at: '2013-06-29T19:35:51Z',
scopes: [ 'public_repo', 'user:email' ]
}
Any thoughts?
I figured out that mocha
will run the tests, but 5 of them fail with "Error: Forbidden". Do I have to set up environment variables for the tests to pass?
It looks like GITHUB_OAUTH_TOKEN
, GITHUB_USERNAME
, and GITHUB_PASSWORD
are what the tests expect, but that should probably be documented (and there should probably be explicit tests that fail when these env vars are not defined.
I'd love to use your project to create a CLI for enabling travis for a GitHub project, but I can't find anything in the travis docs that mentions how that might be accomplished. Any advice? thanks!
Just wanted to point out that if you are getting this error, "you are currently not allowed to perform this request. please contact [email protected]."
It is not related to the client, it is Travis. See travis-ci/travis-ci#5649
Receiving warning on install:
npm WARN deprecated [email protected]: 'github' has been renamed to '@octokit/rest'
Would be great if this library return promises if a callback is not present for apis.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.