Skip to content

Commit

Permalink
Improve changelog validation (#1062)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndpnt authored Mar 14, 2024
2 parents 936e388 + d0e2d40 commit 4592a8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased [no-release]

_Modifications made in this changeset do not add, remove or alter any behavior, dependency, API or functionality of the software. They only change non-functional parts of the repository, such as the README file or CI workflows._

## 0.37.1 - 2024-02-20

_Full changeset and discussions: [#1056](https://github.com/OpenTermsArchive/engine/pull/1056)._
Expand Down
3 changes: 2 additions & 1 deletion scripts/changelog/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import semver from 'semver';
import ChangelogValidationError from './changelogValidationError.js';

export default class Changelog {
static NO_CODE_CHANGES_REGEX = /^_No code changes were made in this release(.+)_$/m;
static FUNDER_REGEX = /^> Development of this release was (?:supported|made on a volunteer basis) by (.+)\.$/m;
static UNRELEASED_REGEX = /## Unreleased[ ]+\[(major|minor|patch)\]/i;
static CHANGESET_LINK_REGEX = /^_Full changeset and discussions: (.+)._$/m;
Expand Down Expand Up @@ -79,7 +80,7 @@ export default class Changelog {
errors.push(new Error('Missing funder in the "Unreleased" section'));
}

if (!unreleased.changes || Array.from(unreleased.changes.values()).every(change => !change.length)) {
if (!Changelog.NO_CODE_CHANGES_REGEX.test(unreleased.description) && (!unreleased.changes || Array.from(unreleased.changes.values()).every(change => !change.length))) {
errors.push(new Error('Missing or malformed changes in the "Unreleased" section'));
}

Expand Down

0 comments on commit 4592a8b

Please sign in to comment.