silas / node-jenkins

Jenkins client
https://www.npmjs.com/package/jenkins
MIT License
356 stars 86 forks source link

Proposal for a PR to add lastBuild and lastSuccessfulBuild #101

Open matt2xu opened 3 years ago

matt2xu commented 3 years ago

Hi,

I'm using this package at work at Teads, and I noticed that there is no functions to get the last build and last successful build, whereas the endpoints are available on Jenkins API.

I'm willing to contribute a PR adding two functions lastBuild and lastSuccessfulBuild to the build.js module, is that ok with you @silas ?

Thanks, Matthieu

matt2xu commented 3 years ago

I've seen that there are several endpoints to get a particular build: lastBuild, lastStableBuild, lastSuccessfulBuild, lastFailedBuild, lastUnstableBuild, lastUnsuccessfulBuild, lastCompletedBuild.

I think it could be interesting to add them all with a loop to avoid too much copy/paste, what do you think?