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

feat(lite/release): add changelog to gh release description #8265

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

S3bastianCZ
Copy link
Contributor

Description

Add changeLog to GitHub release description

Checklist

  • Commit
    • Title follows commit conventions
    • Reference the relevant issue (Fixes #007, See xoa-support#42, See https://...)
    • If bug fix, add Introduced by
  • Changelog
    • If visible by XOA users, add changelog entry
    • Update "Packages to release" in CHANGELOG.unreleased.md
  • PR
    • If UI changes, add screenshots
    • If not finished or not tested, open as Draft

Review process

This 2-passes review process aims to:

  • develop skills of junior reviewers
  • limit the workload for senior reviewers
  • limit the number of unnecessary changes by the author
  1. The author creates a PR.
  2. Review process:
    1. The author assigns the junior reviewer.
    2. The junior reviewer conducts their review:
      • Resolves their comments if they are addressed.
      • Adds comments if necessary or approves the PR.
    3. The junior reviewer assigns the senior reviewer.
    4. The senior reviewer conducts their review:
      • If there are no unresolved comments on the PR → merge.
      • Otherwise, we continue with 3.
  3. The author responds to comments and/or makes corrections, and we go back to 2.

Notes:

  1. The author can request a review at any time, even if the PR is still a Draft.
  2. In theory, there should not be more than one reviewer at a time.
  3. The author should not make any changes:
    • When a reviewer is assigned.
    • Between the junior and senior reviews.

@S3bastianCZ S3bastianCZ requested a review from pdonias January 23, 2025 11:10
@S3bastianCZ S3bastianCZ self-assigned this Jan 23, 2025
const getChangelogForVersion = (version, changelogPath = './CHANGELOG.md') => {
const changelog = readFileSync(changelogPath, 'utf8')

const versionRegex = new RegExp(`## \\*\\*${version}\\*\\*.*?(?=\\n## \\*\\*|$)`, 's')
Copy link
Member

Choose a reason for hiding this comment

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

You might want to escape . characters in version.

@@ -342,11 +352,14 @@ if (ghRelease) {
stop()
}
} else {
const releaseNotes = getChangelogForVersion(version)
Copy link
Member

Choose a reason for hiding this comment

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

I think we should at least prompt something if releaseNotes is null because it's not expected and it might mean something is wrong with the version numbers.

@@ -4,6 +4,7 @@ import argv from 'minimist'
import { tmpdir } from 'os'
import { fileURLToPath, URL } from 'url'
import { $, cd, chalk, fs, path, question, within } from 'zx'
import { readFileSync } from 'fs'
Copy link
Member

Choose a reason for hiding this comment

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

You can use fs.readFile from the zx library.

@S3bastianCZ S3bastianCZ force-pushed the Add-Changelog-to-GH-release-description branch from d6682e2 to 03c16e5 Compare January 24, 2025 10:03
@S3bastianCZ S3bastianCZ requested a review from pdonias January 24, 2025 10:04
Comment on lines 346 to 347
if (!releaseNotes) {
if (await no(`No changelog found for version ${version}. There might be a problem with the version number.`)) {
Copy link
Member

Choose a reason for hiding this comment

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

There needs to be a question like "Continue anyway?" at the end of the prompt and you only need one if with the 2 conditions.

Copy link
Member

Choose a reason for hiding this comment

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

And I think I'd also like to re-organize this chunk of code into something that looks like this in terms of logic so that we don't prompt about a missing changelog if the release already exists anyway:

release = ghApiCall(...).find(...)

if (release !== undefined && no('release already exists, continue?')) {
  stop()
}

if (release === undefined) {
  releaseNotes = getChangelogForVersion(version)

  if (releaseNotes === undefined && no('changelog not found, continue?')) {
    stop()
  }

  release = ghApiCall(..., { ..., body: releaseNotes })
}

Does it make sense? We can also do that in another PR if you think it's drifting too much away from the purpose of this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a good idea, I will implement this

@S3bastianCZ S3bastianCZ force-pushed the Add-Changelog-to-GH-release-description branch from 60bba38 to a5b0322 Compare January 24, 2025 14:54
@S3bastianCZ S3bastianCZ requested a review from pdonias January 24, 2025 14:55
)}). Skip and proceed with upload?`
)
) {
if (release !== undefined && (await no('release already exists, continue?'))) {
Copy link
Member

Choose a reason for hiding this comment

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

You can keep the longer prompts though, this was just for the example :)

@S3bastianCZ S3bastianCZ requested a review from pdonias January 27, 2025 12:41
if (release === undefined) {
const releaseNotes = await getChangelogForVersion(version)

if (releaseNotes === undefined && (await no('changelog not found, continue?'))) {
Copy link
Member

Choose a reason for hiding this comment

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

This one too :) At least mentioning the version number for easier debug.

@S3bastianCZ S3bastianCZ requested a review from pdonias January 28, 2025 09:39
@julien-f julien-f changed the title feat(xo-lite): add changelog to gh release description feat(lite/release): add changelog to gh release description Jan 28, 2025
)
releaseNotes === undefined &&
(await no(
`Could not find changelog for version ${version}.(${chalk.yellow(release.html_url)}). Create release without changelog?`
Copy link
Member

Choose a reason for hiding this comment

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

release is undefined here.

Suggested change
`Could not find changelog for version ${version}.(${chalk.yellow(release.html_url)}). Create release without changelog?`
`Could not find changelog for version ${version}. Create release without changelog?`

@S3bastianCZ S3bastianCZ requested a review from pdonias January 29, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants