github-action-get-previous-tag icon indicating copy to clipboard operation
github-action-get-previous-tag copied to clipboard

Look further back in history?

Open cmsj opened this issue 4 years ago • 3 comments

Hey

I'm working on an Actions workflow to gather some information about PRs that were merged in a particular release, triggered by the creation of a new tag.

So for example if I tag 1.1 I would want to be able to run some git commands that specify a range of 1.0..1.1.

This action is excellent for getting the 1.1, but AFAICT I can't use it to figure out what the tag before that was (ie the 1.0).

Is that something that could be added?

cmsj avatar Apr 27 '21 13:04 cmsj

That should be possible, does git support this out of the box? If so how? Otherwise, we could look at regexp or another way of matching.

Just to complete idea of what you're trying to do: You have several version branches like 1.1.x, 1.x.x, 1.0.x`. And you went per branch to get the previous tag for that range was? (This is the thing I want to do in the end on my own repo's, so if that idea matches with yours that would;d be awesome.)

WyriHaximus avatar Apr 27 '21 16:04 WyriHaximus

I ended up with this incantation:

      - name: Get previous tag name
        id: previous_tag
        run: echo "::set-output name=TAGNAME::$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))"

which seems to work, but I don't do a lot of complicated branching.

cmsj avatar May 01 '21 13:05 cmsj

Ow nice one, might add the skip to the action :+1:

WyriHaximus avatar Jun 30 '21 20:06 WyriHaximus