Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] 'fetch-depth: 0' always miss current tag #1190

Closed
Freed-Wu opened this issue Feb 26, 2023 · 3 comments
Closed

[bug] 'fetch-depth: 0' always miss current tag #1190

Freed-Wu opened this issue Feb 26, 2023 · 3 comments

Comments

@Freed-Wu
Copy link

"on":
  push:
    paths-ignore:
      - "**.md"
  pull_request:
    paths-ignore:
      - "**.md"
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

Then

git tag 0.0.3
git push --tags

Expected: in CI machine, git describe will return 0.0.3
Actual: 0.0.2-1-ged78cae

@Freed-Wu
Copy link
Author

Freed-Wu commented Mar 2, 2023

More detail:

I create a perl project, in its Makefile.PL, I write:

my $VERSION = `git describe`;
chomp $VERSION;

However, I find git describe always return some 0.0.1-1-g3c8d998s, not true 0.0.2.

If I change to:

my $VERSION = `git tag`;
chomp $VERSION;
$VERSION =~ s/.*\n//g;

It looks can work.

@Freed-Wu
Copy link
Author

Freed-Wu commented Mar 4, 2023

Oh, I see. We must use $GITHUB_REF_NAME to get 0.0.2 in github action yaml or Makefile.PL, not git describe.

@Freed-Wu Freed-Wu closed this as completed Mar 4, 2023
@armandas
Copy link

Also, see this answer on SO: https://stackoverflow.com/a/74224803/1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants