question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preserve tag annotations

See original GitHub issue

The technique this tool uses for checking out tags only preserves the relation between tag and ref, not any annotations created with git tag -a.

git fetch origin +$HASH:refs/tags/$TAG
git checkout -f refs/tag/$TAG

I have a CI action that depends on information from annotated tags. Specifically, the name of the person who applied the tag: git tag --list --points-at HEAD --format '%(taggeremail)' (I can’t use ${{ github.actor }} for reasons).

The workaround is to run git fetch -f origin ${{ github.ref }}:${{ github.ref }}. But it would be better not to need this workaround.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:47
  • Comments:23

github_iconTop GitHub Comments

13reactions
morronecommented, Jul 17, 2020

Agreed! This breaks the “git describe” command too. We need tags to be in their correct original form.

12reactions
Envekcommented, Aug 25, 2020

+1 on preserving tag annotations. fetch-depth: 0 alone doesn’t help, git fetch --tags --force does help.

name: Create release from annotated tag
on: push
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0 # Doesn't help
      - name: "Extract data from tag: version, message, body"
        id: tag
        run: |
          git fetch --tags --force # Retrieve annotated tags. THIS TRICK REALLY HELPS
          echo ::set-output name=subject::$(git for-each-ref $GITHUB_REF --format='%(contents:subject)')
          # …
      - name: Create Release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ steps.tag.outputs.subject }}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Correct Tagged Annotations When They Failed the ...
How To Correct Tagged Annotations When They Failed the Accessibility Check in a Form.
Read more >
How do I change the date of an annotated Git tag without ...
The answer you linked simply creates a new annotated tag, ... To save the tag's message, use git cat-file -p $tag (or git...
Read more >
Git - Tagging - Git SCM
Annotated tags, however, are stored as full objects in the Git database. They're checksummed; contain the tagger name, email, and date; have a...
Read more >
Disabling tag sets - IBM
The concept of disabled tag sets allows the preservation of changes when the descriptor file is being used for edits. If you change...
Read more >
Annotated and Lightweight Git Tags | HackerNoon
Annotated tags store extra metadata such as author name, release notes, tag-message, and date as full objects in the Git database. All this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found