user892077
user892077

Reputation: 33

Bitbucket API to get the latest tag on a particular branch

I want to get the latest tag on a particular branch.

For example, for a branch release/fix, there are n commits, but for each commit, tags are not generated:

commit #111 - no tag present
commit #110 - tag 1.1.1
commit #109 - tag 1.1.0
commit #108 - no tag present

So, the latest tag would be 1.1.1 for the branch release/fix.

I need to get this via the Bitbucket API.

I tried to get the latest commit on a particular branch using https://bitbucket.x.com/rest/api/latest/projects/{}/repos/myrepo/commits?until=refs/heads/release/fix&limit=1 and get the tags using https://bitbucket.x.com/rest/tags/latest/projects/{}/repos/myrepo/tags - POST call with the commit #.

But the issue with above approach is that it is not neccessary that the latest commit on that branch would have a tag associated with it.

Upvotes: 0

Views: 122

Answers (0)

Related Questions