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

ci: add ability to generate release notes from conventional commits #1623

Merged
merged 1 commit into from
May 8, 2023
Merged

ci: add ability to generate release notes from conventional commits #1623

merged 1 commit into from
May 8, 2023

Conversation

jmartin4563
Copy link
Contributor

Proposed Release Notes

Created the ConventionalChangelog class, which has methods for parsing conventional commits from the git log, as well as methods for generating JSON and Markdown changelogs. JSON changelogs will be used by the docs-website PR script to generate the front-matter for Agent Version Metadata service. Markdown changelogs are for our own documentation and for customers to read.

Links

Details

The expectation is that this class will be used in NR-96236, where we'll conditionally (since the external repos use the same scripting) update prepare-release.js to use this class, and create-docs-pr.js to consume changelog.json for the front-matter fields.

To manually test, use the following script and observe the updates to NEWS.md and changelog.json

const ConventionalChangelog = require('./conventional-changelog')

const changelog = new ConventionalChangelog({
  newVersion: '10.1.0',
  previousVersion: '9.8.0',
  repo: 'node-newrelic',
  org: 'newrelic'
})

changelog
  .getFormattedCommits()
  .then((commits) => {
    return Promise.all([
      changelog.generateMarkdownChangelog(commits),
      changelog.generateJsonChangelog(commits)
    ])
  })
  .then(([markdownChangelog, jsonChangelog]) => {
    return Promise.all([
      changelog.writeMarkdownChangelog(markdownChangelog),
      changelog.writeJsonChangelog(jsonChangelog)
    ])
  })
  .then(() => {
    console.log("Job's finished")
  })

Created the ConventionalChangelog class, which has methods for parsing
conventional commits from the git log, as well as methods for generating
JSON and Markdown changelogs. JSON changelogs will be used by the
docs-website PR script to generate the front-matter for Agent Version
Metadata service. Markdown changelogs are for our own documentation and
for customers to read
@jmartin4563 jmartin4563 added the dev:automation Indicates CI automation label May 5, 2023
@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Merging #1623 (4ef918e) into main (fe11bf6) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1623   +/-   ##
=======================================
  Coverage   96.39%   96.39%           
=======================================
  Files         200      200           
  Lines       39053    39053           
  Branches       24       24           
=======================================
  Hits        37644    37644           
  Misses       1409     1409           
Flag Coverage Δ
esm-unit-tests-14.x 47.80% <ø> (ø)
esm-unit-tests-16.x 92.11% <ø> (ø)
esm-unit-tests-18.x 92.11% <ø> (ø)
integration-tests-14.x ?
integration-tests-16.x 79.04% <ø> (-0.01%) ⬇️
integration-tests-18.x ?
unit-tests-14.x 90.48% <ø> (ø)
unit-tests-16.x ?
unit-tests-18.x 90.52% <ø> (ø)
versioned-tests-14.x ?
versioned-tests-16.x 76.56% <ø> (ø)
versioned-tests-18.x 76.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mrickard mrickard self-assigned this May 5, 2023
jmartin4563 added a commit that referenced this pull request May 5, 2023
We've decided as a team to drop release-please in lieu of #1623, this PR just removes the remnants of release-please configuration/automation.

{{#if noteGroups}}
{{#each noteGroups}}
#### ⚠ {{title}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that triangle-and-! character in the space intentionally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Looks like it might be for breaking changes.)

Copy link
Contributor Author

@jmartin4563 jmartin4563 May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is for breaking changes. I'm not sure why they do this, but currently the only supported note type is a breaking change, so noteGroups only has one possible group, which is also breaking change (see https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-commits-parser/test/parser.spec.js for examples of what comes out of the parser)

@jmartin4563 jmartin4563 merged commit 880a88b into newrelic:main May 8, 2023
@jmartin4563 jmartin4563 deleted the conventional-commit-release-notes branch May 8, 2023 16:24
@github-actions github-actions bot mentioned this pull request May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev:automation Indicates CI automation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants