Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get the creation date of a tag in BitBucket Server

mikimicheli January 21, 2020

Using BitBucket Server (aka Stash) version 6.3.0 I am trying to filter tags of a repository according to a specific date range, but can't find the creation date of a tag.

 

From the API Docs, using the GET /REST/API/1.0/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/TAGS API we can order the results by modification date, but the tag object itself does not contain a created/updated field. This is not related to if the tag is annotated or not.

 

Tag response:

{
    "size": 1,
    "limit": 25,
    "isLastPage": true,
    "values": [
        {
            "id": "release-2.0.0",
            "displayId": "refs/tags/release-2.0.0",
            "type": "TAG",
            "latestCommit": "8d351a10fb428c0c1239530256e21cf24f136e73",
            "latestChangeset": "8d351a10fb428c0c1239530256e21cf24f136e73",
            "hash": "8d51122def5632836d1cb1026e879069e10a1e13"
        }
    ],
    "start": 0
}

 

The only option I have found so far is to fetch the commit itself, but the date of the commit isn't necessarily the date of the tag as I can create a tag at any point in time regardless of the commit author/commiter date.

Does anyone know of any workaround regarding this that I can use in order to get the creation date of a tag?

1 answer

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 24, 2020

Hi @mikimicheli,

Welcome to Atlassian Community.

The only way to get the date of the tag is to use the git show <tag> command, that will give you the date when the tag was created.

pse-asalar February 21, 2020

I'm also trying to do exactly this. In the Bitbucket cloud rest API we get a date when the tag was created but in the Bitbucket Server we don't. 

If I'm using API calls is because I can't use git commands in the scripts I'm building. Is there any other alternative?

I use the creation date of the tag to compare then with the merge date of pull requests to provide a list of (origin) branches that got merged since the tag was created (in other words: the branch names (not code diffs or commit list) of which changes are not included in the specified tag)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events