Right now I can get my travis shield to either reflect the latest run, or a specific branch, irrespective of what branch I select in my github project page. I can do this b
This is not a perfect solution, but if you're already knit
-ing your README from a README.Rmd, there's no added cost. Basically, you can use a system call in your README.Rmd to dynamically generate the Travis-CI shield based on whatever branch you're working in. It will be up to date and branch-specific as long as you always knit
before pushing to GitHub.
Here's a simple example:
# Example README.Rmd
Here's a branch specific shield:
```{r, echo=FALSE, eval=TRUE, results="asis"}
travis_url <- "https://travis-ci.org/RevolutionAnalytics/miniCRAN.svg?branch="
shield <- paste0("[,
")](https://travis-ci.org/RevolutionAnalytics/miniCRAN)")
cat(shield)
```
The result will be like this:
# Example README.Rmd
Here's a branch specific shield:
[](https://travis-ci.org/RevolutionAnalytics/miniCRAN)
but the URL will point to whatever branch you're currently working on.
Note: h/t to this answer for the relevant git command to detect the current branch name.
I make use of Travis build shields for miniCRAN, and the solution is quite simple.
Note the addition of ?branch=...
at the end of each travis shield link.
Here is an extract from the README.md
:
**Build status**
master:
[](https://travis-ci.org/andrie/miniCRAN)
release:
[](https://travis-ci.org/andrie/miniCRAN)
dev: [](https://travis-ci.org/andrie/miniCRAN)
This results in:
Build status
master: release: dev: