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

Support "standard-version" changelog format #5181

Closed
2 of 11 tasks
Tracked by #14138
simoneb opened this issue Jan 16, 2020 · 15 comments
Closed
2 of 11 tasks
Tracked by #14138

Support "standard-version" changelog format #5181

simoneb opened this issue Jan 16, 2020 · 15 comments
Labels
core:changelogs Related to changelogs/release notes fetching help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@simoneb
Copy link

simoneb commented Jan 16, 2020

Which Renovate are you using? x the right box:

  • Renovate Open Source CLI
  • WhiteSource Renovate App
  • Renovate Pro
  • Other (please write below)

Which platform are you using? x the right box:

  • GitHub.com
  • GitHub Enterprise
  • GitLab.com
  • GitLab self-hosted
  • Bitbucket Server
  • Bitbucket Cloud
  • Azure DevOps

What would you like to do?

Show releases notes from the target package's CHANGELOG.md file formatted using semantic versioning tooling.

Right now, if the target package has a CHANGELOG.md file formatted in a way similar to this (using the standard-version toolchain):

# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.1.13](https://github.com/org/pkg/compare/v0.1.12...v0.1.13) (2020-01-15)

### Features

* some feature ([a813e4c](https://github.com/org/pkg/commit/a813e4cc3db9fed5d86fa7391aeec0a62bc9d1f4))

### [0.1.12](https://github.com/org/pkg/compare/v0.1.10...v0.1.12) (2020-01-14)

### Features

* some other feature ([f21e1dd](https://github.com/org/pkg/commit/f21e1dd6f81e098322e9598195da9cc24fa6f868))

In a Renovate PR for bumping that package version, say from 0.1.12 to 0.1.13 I get something similar to this:

image

Meaning that it can somehow pick some version information, but I would like to see the actual features introduced similarly to what's in the CHANGELOG.md file rather than just the version number and a link to the diff.

@rarkins
Copy link
Collaborator

rarkins commented Jan 16, 2020

Are you sure that it's even finding the CHANGELOG? What are the logs for when it's retrieving it?

@rarkins
Copy link
Collaborator

rarkins commented Jan 16, 2020

Assuming the source repo CHANGELOG is being found but not parsed correctly, a good next step would be to create a work-in-progress PR that adds your file to https://github.com/renovatebot/renovate/tree/master/test/workers/pr/_fixtures plus a failing test case.

@simoneb
Copy link
Author

simoneb commented Jan 17, 2020

Are you sure that it's even finding the CHANGELOG? What are the logs for when it's retrieving it?

How do I know? Looking at one of the job logs for that PR I can't find anything pertaining CHANGELOG or release notes. See for instance job 132030815

@simoneb
Copy link
Author

simoneb commented Jan 17, 2020

Also, where would the changelog file need to be located for Renovate to be able to pick it up? Currently it's in the root folder of the repo and it's bundled in the package. But, for instance, the package is transpiled and the output goes to a dist folder inside the package, pointed to by the main field of the package.json file. That dist folder doesn't contain the changelog file:

Here's what the package contents looks like:

|- dist
|--- index.js
|- CHANGELOG.md
|- package.json 

@rarkins
Copy link
Collaborator

rarkins commented Jan 17, 2020

In the simplest case Renovate:

  • Determines the source repository based on metadata in the published package.json
  • Looks for CHANGELOG-ish files within the root of that directory
  • Attempts to parse that file for headers

If this is a private repository on GitHub.com then it means you must have installed Renovate into it for Renovate to have authorization to access that repo to get the changelog.

I think that the format you're using is likely to confuse Renovate's parser. I find it to be a strange format, even if it's commonly used. Typically "features" should be a subheading of a release and not at the same level. e.g. in the example you gave, they both use ### headers:

### [0.1.13](https://github.com/org/pkg/compare/v0.1.12...v0.1.13) (2020-01-15)

### Features
* some feature ([a813e4c](https://github.com/org/pkg/commit/a813e4cc3db9fed5d86fa7391aeec0a62bc9d1f4))

It makes no sense to me why the release couldn't be a ## header instead.

But anyway of course Renovate could be enhanced to detect this, but it takes a test case first and then someone to do it.

@simoneb
Copy link
Author

simoneb commented Jan 17, 2020

The changelog I showed is generated entirely automatically by https://github.com/conventional-changelog/standard-version/.

And indeed I notice now that the markdown headers are somewhat inconsistent, not sure if intentionally or because of a bug, but I find the same even in their own changelog. I have a feeling they use different headings for different semver types of releases (major/minor/patch), which kinda makes sense.

See their changelog here: https://github.com/conventional-changelog/standard-version/blob/master/CHANGELOG.md

This is pretty standard tooling, I would expect Renovate to be able to parse it :)

@rarkins rarkins changed the title Show release notes from a package's CHANGELOG.md file Support "standard-version" changelog format Jan 17, 2020
@rarkins rarkins transferred this issue from renovatebot/config-help Jan 17, 2020
@rarkins rarkins added type:feature Feature (new functionality) help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Jan 17, 2020
@rarkins
Copy link
Collaborator

rarkins commented Jan 17, 2020

I've transferred this issue into the main repo as a feature request and added the latest standard-version changelog as a text fixture in this branch: https://github.com/renovatebot/renovate/tree/feat/standard-version-changelog-support

Still needs:

  • Failing test case
  • Implementation to detect and parse this format

@simoneb
Copy link
Author

simoneb commented Jan 17, 2020

Is there anything else I can provide?

@rarkins
Copy link
Collaborator

rarkins commented Jan 17, 2020

You could submit a pull request to that branch adding a failing test case for the standard-version fixture. Example test case:

it('parses jest', async () => {
ghGot
.mockResolvedValueOnce({ body: contentsResponse })
.mockResolvedValueOnce({
body: {
content: Buffer.from(jestChangelogMd).toString('base64'),
},
});
const res = await getReleaseNotesMd(
'facebook/jest',
'22.0.0',
'https://github.com/',
'https://api.github.com/'
);
expect(res).not.toBeNull();
expect(res).toMatchSnapshot();
});

In this case though it is not enough to just check that it's not null. We need to check that the patch versions in the new fixture are included, e.g. 7.0.1.

@simoneb
Copy link
Author

simoneb commented Jan 17, 2020

Ok done that, but the test doesn't fail and I would use some help to figure out what's wrong. The CHANGELOG is parsed, but it seems it's simply parsed, not sure how to check that all the versions are being picked up.

#5183

@rarkins
Copy link
Collaborator

rarkins commented Jan 18, 2020

Tests are now failing in that branch

@simoneb
Copy link
Author

simoneb commented Jan 18, 2020

@rarkins I see you merged my PR. In that PR the checks were all green, how do I see the tests failing for the branch the PR merged into? On GH actions all seems good as far as I can see

@rarkins
Copy link
Collaborator

rarkins commented Jan 18, 2020

Actually I just merged it in order for me to make some changes to your tests to get them to fail. See 66213cb

@simoneb
Copy link
Author

simoneb commented Jan 18, 2020

Thanks!

@setchy
Copy link
Collaborator

setchy commented Jul 3, 2023

@rarkins - i was briefly exploring this this morning and it looks like Renovate does support standard-version changelogs

Anything left on this or should we close it?

@rarkins rarkins closed this as completed Jul 3, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
core:changelogs Related to changelogs/release notes fetching help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

No branches or pull requests

3 participants