Skip to content

Commit d0e0130

Browse files
authored
Merge pull request #98 from WeTransfer/feature/github-release-notes
Add the possibility to let GitHub generate release notes
2 parents 2dc8706 + 435ba2b commit d0e0130

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/GitBuddyCore/Commands/ReleaseCommand.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ struct ReleaseCommand: ParsableCommand {
7272
@Flag(name: .customLong("sections"), help: "Whether the changelog should be split into sections. Defaults to false.")
7373
private var isSectioned: Bool = false
7474

75+
@Flag(name: .customLong("useGitHubReleaseNotes"), help: "If `true`, release notes will be generated by GitHub. Defaults to false, which will lead to a changelog based on PR and issue titles matching the tag changes.")
76+
private var useGitHubReleaseNotes: Bool = false
77+
7578
@Flag(name: .customLong("json"), help: "Whether the release output should be in JSON, containing more details. Defaults to false.")
7679
private var shouldUseJSONOutput: Bool = false
7780

@@ -89,7 +92,8 @@ struct ReleaseCommand: ParsableCommand {
8992
releaseTitle: releaseTitle,
9093
lastReleaseTag: lastReleaseTag,
9194
baseBranch: baseBranch,
92-
changelogToTag: changelogToTag)
95+
changelogToTag: changelogToTag,
96+
useGitHubReleaseNotes: useGitHubReleaseNotes)
9397
let release = try releaseProducer.run(isSectioned: isSectioned)
9498

9599
if shouldUseJSONOutput {

Sources/GitBuddyCore/Release/ReleaseProducer.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable {
3232
let lastReleaseTag: String?
3333
let changelogToTag: String?
3434
let baseBranch: String
35+
let useGitHubReleaseNotes: Bool
3536

3637
init(
3738
changelogPath: String?,
@@ -42,7 +43,8 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable {
4243
releaseTitle: String? = nil,
4344
lastReleaseTag: String? = nil,
4445
baseBranch: String? = nil,
45-
changelogToTag: String? = nil
46+
changelogToTag: String? = nil,
47+
useGitHubReleaseNotes: Bool
4648
) throws {
4749
try Octokit.authenticate()
4850

@@ -59,6 +61,7 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable {
5961
self.lastReleaseTag = lastReleaseTag
6062
self.changelogToTag = changelogToTag
6163
self.baseBranch = baseBranch ?? "master"
64+
self.useGitHubReleaseNotes = useGitHubReleaseNotes
6265
}
6366

6467
@discardableResult public func run(isSectioned: Bool) throws -> Release {
@@ -187,6 +190,7 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable {
187190
prerelease: \(isPrerelease)
188191
draft: false
189192
title: \(releaseTitle)
193+
useGitHubReleaseNotes: \(useGitHubReleaseNotes)
190194
body:
191195
\(body)\n
192196
""")
@@ -201,7 +205,8 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable {
201205
name: releaseTitle,
202206
body: body,
203207
prerelease: isPrerelease,
204-
draft: false
208+
draft: false,
209+
generateReleaseNotes: useGitHubReleaseNotes
205210
) { response in
206211
switch response {
207212
case .success(let release):

0 commit comments

Comments
 (0)