Created
March 15, 2019 15:10
-
-
Save halfhp/0422fb2dd3f09d1067aef1f42a2af70b to your computer and use it in GitHub Desktop.
Use the circle API to get the link to the latest build for a given project / branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script> | |
var url = new URL(window.location.href) | |
var user = url.searchParams.get("user") | |
var repo = url.searchParams.get("repo") | |
var branch = url.searchParams.get("branch") | |
var token = url.searchParams.get("token") | |
var circleUrl = "https://circleci.com/api/v1.1/project/github/" + user + "/" + repo + "/tree/" + branch + "?circle-token=" + token | |
$.getJSON(circleUrl, function( data ) { | |
window.location.replace(data[0].build_url) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If your project is private you'll need to generate a circle API token with artifact access and include it as a url param when hitting this page.