Are you experiencing an issue with...
:beetle: Description
The Azure DevOps badge always shows test results of latest build, even if this build not refers to the configured branch.
:link: Link to the badge
https://img.shields.io/azure-devops/tests/jopohl/urh/2/master.svg
Note, badge says 2176 tests passed while this should truly be 2720. The number 2176 comes from a build which was made on another branch. Overview of builds is here: https://dev.azure.com/jopohl/urh/_build?definitionId=2
:bulb: Possible Solution
Configured branch should be evaluated to get test results from latest build on branch and not latest build overall.
Looks like the underlying API changed the query param for branches from branch to branchName which is why the latest build id is always being used (this would impact the other Azure DevOps badges too)
I'll take this one
馃 it doesn't look like the API is going to accept the branchName query param (when used, the results always come back empty). this may need an upstream fix from Microsoft, although given that this API is still in preview mode I don't know how quickly it will get resolved
https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-5.1
https://dev.azure.com/jopohl/urh/_apis/build/builds?$top=1&definitions=2&api-version=5.1-preview.5&branchName=master
(try dropping the branchName query param off to get results)
Okay it looks like it _will_ work (once I add the update), but it will require the verbose branch name annoyingly: refs/heads/init, refs/heads/master, refs/heads/winbuild37
Should we include refs/heads implicitly so the user doesn't need to specify it?
That'd definitely be a better user experience!
Azure DevOps does list the associated "branch" as something different on certain PR builds though (I got one like this: refs/pull/38/merge for example). I don't _think_ that would matter in practice, as I think that could only manifest for badges if someone attempted to create a badge for branch in a fork? (maybe?)
Alright I've updated #2777 accordingly to prefix refs/heads if not included, allowing users to simplify specify their desired branch name