intuit/auto

Preview CHANGELOG in PR

Opened this issue ยท 2 comments

Is your feature request related to a problem? Please describe.

I'd like to see a preview of what the CHANGELOG generated from commits will look like.

Describe the solution you'd like

Much like the pre-release (canary) section that @auto-it adds to the body of a PR. It would be neat if there would be a preview of the CHANGELOG too. That'll make it easy to spot errors or "review" the changelog :)

Example of current pre-release functionality:

<!-- GITHUB_RELEASE PR BODY: canary-version -->
<details>
  <summary>๐Ÿ“ฆ Published PR as canary version: <code>Canary Versions</code></summary>
  ...
</details>
<!-- GITHUB_RELEASE PR BODY: canary-version -->

Something like this would be welcome:

<!-- GITHUB_CHANGELOG BODY -->
<details>
  <summary>๐Ÿ“– CHANGELOG</summary>
  ...
</details>
<!-- GITHUB_CHANGELOG BODY -->

Describe alternatives you've considered

none

Additional context

none

This seems to write the canary versions to the PR body

auto/plugins/npm/src/index.ts

Lines 1171 to 1176 in 1a84048

return {
newVersion: "Canary Versions",
details: makeMonorepoInstallList(
packageList.filter((p) => p.includes("canary"))
),
};

This seems to generate the changelog with the changes since last release

/** Make the class that will generate changelogs for the project */
@memoize()
async makeChangelog(version?: SEMVER) {
const project = await this.git.getProject();
const changelog = new Changelog(this.logger, {
owner: this.git.options.owner,
repo: this.git.options.repo,
baseUrl: project.html_url,
labels: this.config.labels,
baseBranch: this.config.baseBranch,
prereleaseBranches: this.config.prereleaseBranches,
});
this.hooks.onCreateChangelog.call(changelog, version);
changelog.loadDefaultHooks();
return changelog;
}

Any one got some insights on how to wire them up ๐Ÿค”

You could probably do this with an auto plugin pretty easily. You could hook into the canary hook and just run the changelog function in auto.