2

I am currently trying to implement an automated release GHA. One of the main features is that it will generate release notes based on previous tags. For some reason every time I generate release notes, Github will populate the release notes with every single branch that has been merged into the branch that I am creating release notes for. It should only be creating release notes for branches that have been merged between tags.

For example, I'm upgrading my repo's version from tag v1.1 to tag v1.2

When generating release notes it will pull in every merge from the branch I am adding a tag to since the beginning of the entire repo. Instead it should only pull in merges since v1.1

I think this might have to do with the fact that my tags aren't properly attached to branches. I am using this command in my GHA action script to get my previous tag.

git describe --tags --abbrev=0

This returns:

fatal: No tags can describe 'ExampleGitSHA'

It seems that GitHub is not recognizing my previous tags for whatever reason.

Farhan Islam
  • 609
  • 2
  • 7
  • 21

1 Answers1

0

Following actions/checkout issue 701, check if your git describe --tags --abbrev=0 fails because your GitHub Action did not fetch any tag.

If that is the case, add a step after the actions/checkout:

      - name: Checkout
        uses: actions/checkout@v3

      - name: Get tags
        run: git fetch --tags origin
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Even running this in the terminal outside of Github actions doesnt work. After fetching the tags locally, i still get the same fatal: No tags can describe error – Farhan Islam Sep 14 '22 at 15:40
  • @FarhanIslam Does `git tag -l` lists `ExampleGitSHA`? – VonC Sep 14 '22 at 15:56
  • It lists the existing tags in the repo – Farhan Islam Sep 15 '22 at 22:01
  • @FarhanIslam Do the "existing tags in the repo" include `ExampleGitSHA`? – VonC Sep 15 '22 at 22:06
  • Yes it does, also weirdly the git describe --tags --abbrev=0 is now working, but it only returns the same tag even though I just published the new tag. I published the new tag and did a git fetch locally, but it still is stuck at the tag before it. – Farhan Islam Sep 15 '22 at 22:19
  • i.e 1.01 -> 1.02, 1.02 -> 1.03. ```git describe --tags --abbrev=0``` stuck at 1.01 even after fetching – Farhan Islam Sep 15 '22 at 22:20
  • @FarhanIslam That would be like, after a checkout, it describes an old commit. Can yo try and add a git pull step, followed by git describe? – VonC Sep 15 '22 at 22:35
  • @FarhanIslam (Back in a few hours, I have to call it a night) – VonC Sep 15 '22 at 22:37
  • Yes I just did a git pull on the branch and still stuck at 1.01 version. Git describe returns fatal: No annotated tags can describe ```ExampleGitSHA```. – Farhan Islam Sep 15 '22 at 22:51