Skip to content

Instantly share code, notes, and snippets.

@Scrxtchy
Created October 20, 2017 02:14
Show Gist options
  • Select an option

  • Save Scrxtchy/5a894d227a866614b7a12e5ca5008b92 to your computer and use it in GitHub Desktop.

Select an option

Save Scrxtchy/5a894d227a866614b7a12e5ca5008b92 to your computer and use it in GitHub Desktop.
<?php
ini_set("allow_url_fopen", "On");
$repo = $_GET["repo"];
$config = 'Configuration: ' .$_GET["conf"];
$platform = 'Platform: ' .$_GET['plat'];
$response = file_get_contents("http://ci.appveyor.com/api/projects/" . $repo);
$builds = (json_decode($response)->{"build"}->{"jobs"});
foreach ($builds as &$build) {
if ($build->{"name"} == $config | $build->{"name"} == $platform) {
if ($build->{"artifactsCount"} > 1){
header('Location: https://ci.appveyor.com/project/ShareX/sharex/build/job/'. $build->{"jobId"} .'/artifacts' );
} else {
$artifacts = json_decode(file_get_contents('http://ci.appveyor.com/api/buildjobs/'. $build->{"jobId"}.'/artifacts'));
header('Location: https://ci.appveyor.com/api/buildjobs/'. $build->{"jobId"}.'/artifacts/'. $artifacts[0]->{"fileName"});
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment