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

Preview CHANGELOG in PR #2316

Open
snebjorn opened this issue Feb 6, 2023 · 2 comments
Open

Preview CHANGELOG in PR #2316

snebjorn opened this issue Feb 6, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@snebjorn
Copy link
Contributor

snebjorn commented Feb 6, 2023

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

@snebjorn snebjorn added the enhancement New feature or request label Feb 6, 2023
@snebjorn
Copy link
Contributor Author

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 🤔

@hipstersmoothie
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants