changelogSummary function

Future<ChangeSummary?> changelogSummary({
  1. required List<Commit> commits,
  2. required String version,
  3. DateTime? now,
})

Outputs a would-be content to a changelog file based on commits.

It first checks if commits have "releaseable" commits using hasReleasableCommits. If it doesn't, it will return null. If it does, it returns with the contents with the given version string for the changes within within commits and now for the date. This will then return with a ChangeSummary.

Implementation

Future<ChangeSummary?> changelogSummary({
  required List<Commit> commits,
  required String version,
  DateTime? now,
}) async {
  if (hasReleasableCommits(commits)) {
    now ??= DateTime.now();
    final summary = _writeContents(commits, Version.parse(version), now);
    return summary;
  }
  return null;
}