Skip to content

Commit bce5a49

Browse files
committed
update
1 parent a8f19de commit bce5a49

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

.github/scripts/update_changelog.dart

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ void main(List<String> args) {
4040
),
4141
);
4242
}
43-
contents = '# Changelog\n\n${(sections.toList()..sort((a, b) {
44-
return compareVersions(b.version, a.version);
45-
})).map((e) => e.toString()).join('\n')}';
43+
contents =
44+
'# Changelog\n\n${(sections.toList()..sort((a, b) {
45+
return compareVersions(b.version, a.version);
46+
})).map((e) => e.toString()).join('\n')}';
4647

4748
file.writeAsStringSync(contents);
4849
print('Changelog updated with version $version.');
@@ -59,8 +60,9 @@ Set<_VersionSection> extractSections(String contents) {
5960
final end = i + 1 < allVersionMatches.length ? allVersionMatches[i + 1].start : contents.length;
6061
final sectionContents = contents.substring(start, end).trim();
6162
final lines = sectionContents.split('\n').where((line) => line.isNotEmpty).toList();
62-
final version =
63-
allVersionMatches[i].group(0)!.substring(4, allVersionMatches[i].group(0)!.length - 1);
63+
final version = allVersionMatches[i]
64+
.group(0)!
65+
.substring(4, allVersionMatches[i].group(0)!.length - 1);
6466
var releasedAt = DateTime.now().toUtc();
6567
final updates = <String>{};
6668
final old = lines
@@ -76,13 +78,7 @@ Set<_VersionSection> extractSections(String contents) {
7678
updates.add(line);
7779
}
7880
}
79-
results.add(
80-
_VersionSection(
81-
version: version,
82-
releasedAt: releasedAt,
83-
updates: updates,
84-
),
85-
);
81+
results.add(_VersionSection(version: version, releasedAt: releasedAt, updates: updates));
8682
}
8783

8884
return results;
@@ -103,11 +99,8 @@ class _VersionSection {
10399
//
104100
//
105101

106-
_VersionSection({
107-
required this.version,
108-
required this.releasedAt,
109-
this.updates = const {},
110-
});
102+
_VersionSection({required this.version, required this.releasedAt, Set<String>? updates})
103+
: this.updates = updates ?? {};
111104

112105
//
113106
//

0 commit comments

Comments
 (0)