Skip to content

bug: use specific version in hook #64

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

Closed
andreacfromtheapp opened this issue Aug 11, 2024 · 6 comments · Fixed by #65
Closed

bug: use specific version in hook #64

andreacfromtheapp opened this issue Aug 11, 2024 · 6 comments · Fixed by #65
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@andreacfromtheapp
Copy link

andreacfromtheapp commented Aug 11, 2024

Describe the bug

  1. I get this warning every time I run pre-commit:
[WARNING] The 'rev' field of repo 'https://github.com/opensource-nepal/commitlint' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.
  1. No matter if I set a specific rev in .pre-commit-config.yaml, running the hook or autoupdate reverts it to just v1

To Reproduce

  1. install hook with specific rev
  2. run hook (So far so good.)
  3. Now run with pre-commit autoupdate and see the rev change

Expected behavior

  1. no warning
  2. if I use a specific rev in .pre-commit-config.yaml it should stick to it

Environment

  • Python version: 3.12.4
  • Package version: I'd like to say 1.2.0 but see above comments about rev not working properly
  • Operating system: macOS 14.6.1

Additional context

the relevant .pre-commit-config.yaml I set but running autoupdate reverts it to just v1:

  - repo: https://github.com/opensource-nepal/commitlint
    rev: v1.2.0
    hooks:
      - id: commitlint
@andreacfromtheapp andreacfromtheapp added bug Something isn't working help wanted Extra attention is needed labels Aug 11, 2024
@aj3sh
Copy link
Member

aj3sh commented Aug 11, 2024

Thanks for reporting the bug.

We are creating a major and minor version tag afterward on every release to support GitHub Actions. This might be causing the issue, as pre-commit takes the latest created tag on autoupdate. We'll look into it in detail.

@andreacfromtheapp
Copy link
Author

thank you for your amazing tools and contributions :)

@aj3sh
Copy link
Member

aj3sh commented Aug 12, 2024

Hi @gacallea, I have updated the tags for v1.2.0 and adjusted the order to v1.2.0, v1.2, and v1. However, it seems that pre-commit prioritizes the two-digit rev over the three-digit rev during autoupdate, and it doesn't show a warning message for the two-digit rev (minor version).

From my perspective, using a minor version tag rev in pre-commit is acceptable. I'll create a PR for it.

@andreacfromtheapp
Copy link
Author

Hi @aj3sh :)

thank you so much for looking into this and for coming up with a change so quickly!

One note if I may: there must be a way to use the full v1.2.0 tho, all other pre-commit hooks I have don't have the issue I reported. I suspect pre-commit is going to warn users with v.12 as well. What do you reckon?

@aj3sh
Copy link
Member

aj3sh commented Aug 12, 2024

Taking reference from other official GitHub action tags, I have decided not to keep the two-digit tags (eg. v1.2) for GitHub actions. This immediately solves this issue.

Ref tags:
https://github.com/actions/checkout/tags
https://github.com/actions/setup-python/tags

@gacallea, now you can use v1.2.0 without any issue :-). Thank you for using our tool.

cc: @sugat009 , @golesuman , @subashcs

@andreacfromtheapp
Copy link
Author

amazing thanks! I confirm it already works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants