flaviostutz / monotag

Semantic versioning for monorepos based on tag prefix, path prefix, affected files and conventional commit
MIT License
9 stars 2 forks source link

`latest` with prefix not recognized unless path matches prefix #24

Closed johnburbridge closed 5 months ago

johnburbridge commented 5 months ago

Hey Flávio, first and foremost, thank you for putting this together. It's exactly the missing piece I've been looking for GitHub Actions and nothing else out there seems to fit the particular use-case of PRs spanning multiple projects, modules or libs. <3

What's broken?

Under my foo module I've set a tag using --prefix=foo/v. (The v is necessary given a pre-existing convention)

$ git log --pretty=oneline

bd2427434ab6c85a878807359c261d73f9d8d6a8 (HEAD -> foo-readme) docs: adding bar's README.md db083e7d46bc6e9e854d6e8c8c1e131c80366964 test: adding second commit 1067248b49a369c78f21cd6df8c7be740932989e (tag: foo/v0.0.1) docs: adding foo's README.md

And can't seem to retrieve it with just the path.

$ npx monotag@1.6.0 latest --path foo/

No tag found

However, if I use the prefix value in place of the path value, it works:

$ npx monotag@1.6.0 latest --path foo/v

foo/v0.0.1

Now, the path isn't foo/v of course. The convention used for tags in this case adds the v in front of the semver, so my expectation was that I should be using just foo/.

This isn't a huge deal since the workaround is to use --prefix=foo/v when tagging and then same value for --path=foo/v when searching for latest, but it's pretty confusing because notes works as intended. For example:

$ npx monotag@1.6.0 notes --from-ref=foo/v0.0.1 --to-ref=HEAD --path=foo/

Misc

  • test: adding second commit

Info

1.6.0

Context

Monorepo with a handful of spring boot services and single shared library. GitHub Actions used for CI.

flaviostutz commented 5 months ago

Hi! Thanks for reporting this in such a detailed way!

I worked a bit on this one and it seems there was a small bug and an undocumented option (--separator) that you can use for that.

Please verify if version 1.6.2 fixes this. Read the readme file to see if you manage to discover how to use it too and give me a feedback pls :)

johnburbridge commented 5 months ago

Brigadão, @flaviostutz!

Will check later today and let you know.

johnburbridge commented 5 months ago

Works like a charm. Thanks again, @flaviostutz!