actions / checkout

Action for checking out a repo
https://github.com/features/actions
MIT License
5.95k stars 1.77k forks source link

fetch-tags is not working according to the docs with v4 #1781

Open 64J0 opened 5 months ago

64J0 commented 5 months ago

Hello, hope you're good. I'm running some experiments in order to build a custom action that demands the tags from the repo. I noticed that it was possible, in theory, just using the fetch-tags: true, but it does not work. I can only get the tags if I use the fetch-depth: 0.

Example workflow:

jobs:
  custom-action:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          path: tagaction
          fetch-tags: true
      - name: Try to get the tags
        run: |
          cd tagaction
          git tag --sort -creatordate

The last command (git tag --sort -creatordate) shows nothing in this case.

But, if I use the fetch-depth: 0, it lists correctly the tags from the repository.

brandonsturgeon commented 4 months ago

I'm getting this too. I don't want to set fetch depth to 0. It looks like git fetch --tags before running my commands works 👍

e: Looks like this still breaks if I use git describe --tags but that might be unrelated.

nerudaj commented 2 months ago

Still an issue.

guettli commented 1 month ago

The issue looks like this for us:

We are running 4.1.7 and use fetch-depth: 0, fetch-tags: true.

git tag -l lists all tags, except the tags we pushed (and which triggered our GithubAction for releasing).

We use git describe to detect the current git-tag. Since the pushed tag is not visible, our release process fails.