-
Notifications
You must be signed in to change notification settings - Fork 15
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
A way to get rid of fromLine
#95
Comments
So, for this to be usable we need |
I'd be interested @hedss, but I'm super busy this week and on leave till the end of the month. Perhaps you can spec out what the api would look like and I can implement when I'm back? |
@craig-mulligan I'll have a think and see if how the onprem stuff goes ;-) And thank you very much for the offer! :) |
The identical thing also tripped up @pimterry recently in balena-io-modules/balena-procbots#348 However I had a bit of a think, and rather than trying to build a template -> version-regex parser, I had an idea for an alternative (possibly easier?) way that we could get rid of The problem that @jhermsmeier and @pimterry stumbled over is that the
in
and then when (Also pinging @jviotti , as the original Versionist author) |
^ This sounds very sensible to me, and would be a great improvement. Even better, I personally wouldn't object to a special case that matched the exact standard header we used to use:
so that if you have exactly that, it automatically replaces it with the new versionist-expected one, and then continues as normal. Seems like a reasonable special case for resin at least (perhaps not externally, but I think this is fairly common more widely too) and that way it'd be far more likely to work straight out of the box, and we'd skip an annoying little manual step we currently have to do over and over again (and which we keep forgetting). |
Almost sounds like you're suggesting Although TBH I'm not sure if such special-case code is worth adding, as it only needs to be done once per repo, rather than every time versionist runs, and...
Presumably at some point we'll have eventually made all our repos versionist-compatible? :)
If my above suggestion were implemented, then we wouldn't be allowed to forget because versionist would keep moaning at us until we fixed it ;-) |
True, and that should definitely be the main fix! But we've still got a lot of repos to get through to migrate I think, and dropping all that work would be nice, if it's easy (but it sounds like it's not) Really, what I'd like is a kind of codemod-for-repos, where I can write a transformation ("if there's a changelog that starts with X, replace it with Y"), and make the change and open a corresponding PR for all repos in an organisation automatically (and get a list of repos that didn't match to check manually too). That'd nicely solve this versionbot setup for most cases, but also handle all the current work to replace travis with circleci, and all sorts in future... |
Yeah, that sounds like a much better (and ultimately more flexible) solution than having versionist doing a specific search'n'replace on the Changelog. |
There was recently a slight slip-up in the
mountutils
repo, where theCHANGELOG.md
wasn't in the correct format balena-io-modules/mountutils#50 (which ironically #90 would have prevented).There were fewer than expected lines in the "changelog header" which meant that the default
fromLine: 6
value also skipped over the leading version line (in this case## v1.2.2 - 2017-08-28
which caused the version-number parsing ofversionist
to get confused, which caused "unexpected results" - VersionBot bumped the version to1.3.0
when we were expecting it to bump to1.2.3
.Once we'd figured out what the problem was, @jhermsmeier suggested that one way to avoid this in future might be to just look for the first version-line, rather than always skipping a hardcoded number of lines.
And I guess to do that, we'd need to be able to convert the first line of the
template
into a regex, which for the default template would mean converting## v{{version}} - {{moment date "Y-MM-DD"}}
into the regex/## v\d+\.\d+\.\d+ \- \d{4}\-\d{2}\-\d{2}/
(which I guess in turn would require versionist to "understand" the templating system being used). And it looks like my semver-regex is too simplistic ;-) https://github.com/sindresorhus/semver-regex/blob/master/index.jsThe text was updated successfully, but these errors were encountered: