Skip to content

bug: use specific version in hook #64

@andreacfromtheapp

Description

@andreacfromtheapp

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

Activity

aj3sh

aj3sh commented on Aug 11, 2024

@aj3sh
Member

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

andreacfromtheapp commented on Aug 11, 2024

@andreacfromtheapp
Author

thank you for your amazing tools and contributions :)

aj3sh

aj3sh commented on Aug 12, 2024

@aj3sh
Member

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

andreacfromtheapp commented on Aug 12, 2024

@andreacfromtheapp
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

aj3sh commented on Aug 12, 2024

@aj3sh
Member

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

andreacfromtheapp commented on Aug 12, 2024

@andreacfromtheapp
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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @andreacfromtheapp@sugat009@aj3sh

    Issue actions

      bug: use specific version in hook · Issue #64 · opensource-nepal/commitlint