Wednesday, 15 May 2013

git - Is there a way to get the latest tag of a given repo using github API v3 -


I'm relatively new to the Github API and I'm struggling to get the latest tags of a given repo.

Question: Why do I need it?

A: As a QA I am responsible for testing and issuing live and in our team about 40 artifacts (Repo in Github ). I want to create a device which lists the projects that are done after the latest tag. So that I can manage the release more efficiently.

Coming to the point

GET / repos /: owner /: repo / tags

P> But this gives a complete list of the tags of the repo.

Is there an easy way to find the latest tags from all the available tags of the above API calls?

If I repeated it through every tag to do the latest search tag (based on the timestamp of each tag) it is not done efficiently to do this because the number of tags increases in time And since I want to repeat this process for at least 10 repops.

Any help would be highly appreciated.

Many thanks in advance

GitHub has the ability to get the latest tag The API is not, as it is for this, it can be because the tags are arbitrary string, it is not necessarily the savers, but it is not really an excuse, because the tags have a timestamp, and GitHub has them Sorting sequentially when returning.

Anyway, the latest tag, you have to call that API, then sort the tag according to the rules. Since these rules are trivial (see point 11 on that link), it is better to use ().

  var gitHubPath = 'iDoRecall / selection-menu'; // example repo var url = 'https://api.github.com/repos/' + gitHubPath + '/ tags'; $ .get (url) .done (function) {var version = data.sort (function (v1, v2) {return semver.compare (v2.name, v1.name)}); $ ('# result' ) .HTML (version [0] .name);});  
  & lt; Script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> & Lt; Script src = "https://rawgit.com/hippich/bower-semver/master/semver.min.js" & gt; & Lt; / Script & gt; & Lt; P & gt; Latest Tags: & lt; Span id = "result" & gt; & Lt; / Span & gt; & Lt; / P & gt;  


No comments:

Post a Comment