通过travis API获取仓库的最新travis构建状态 [英] Get latest travis build status of a repo through travis API

查看:74
本文介绍了通过travis API获取仓库的最新travis构建状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过其API获取回购的最新travis构建状态。我需要一种与构建状态标志相同的行为,即即使 pull_request失败了,它也会在推通过时显示通过。

I need to get the latest travis build status of a repo through their API. I need a behavior identical to that of build status badge i.e it shows passing when a "push" is passing, even if a newer "pull_request" is failing.

一种方法实现的方法是使用列出所有回购版本,然后反向遍历直到找到不是拉取请求的构建,然后检查其状态。

One way of achieving is to list all builds of a repo using this and then traverse in reverse direction until I find a build which is not a pull requests and then check its status.

但是,必须有一种简短的方法,因为建立状态徽章。每次遍历构建都只是为了获得最后的构建状态似乎很痛苦。

However, there must be a short way of doing it because the same behavior is used by build status badge. Traversing the builds every time just to get the last build status seems like a pain.

构建状态批处理直接获取最后的推送所使用的API端点是什么?

What is the API endpoint use by build status batch to directly get the last "push" build status of a repo?

推荐答案

最简单的解决方案是不使用Travis API,而是使用构建状态标记。测试通过或失败作为文本嵌入SVG图像中:

The easiest solution is to not use Travis API but the build status badge. The test "passing" or "failing" is embedded as text in the SVG image:

curl -s 'https://api.travis-ci.org/$USER/$REPO.svg?branch=$BRANCH' | grep pass
curl -s 'https://api.travis-ci.org/$USER/$REPO.svg?branch=$BRANCH' | grep fail

这篇关于通过travis API获取仓库的最新travis构建状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆