diff --git a/Package.resolved b/Package.resolved index 64bed6d..b6ac9e4 100644 --- a/Package.resolved +++ b/Package.resolved @@ -15,7 +15,7 @@ "repositoryURL": "https://github.com/WeTransfer/octokit.swift", "state": { "branch": "main", - "revision": "f20ac29a920aa8a7b36340d7f285a727e9b30d6e", + "revision": "3d0fea9587af530cb13ef5801a3cb90186fce43e", "version": null } }, diff --git a/Sources/GitBuddyCore/Commands/ReleaseCommand.swift b/Sources/GitBuddyCore/Commands/ReleaseCommand.swift index d62ce21..dfe545e 100644 --- a/Sources/GitBuddyCore/Commands/ReleaseCommand.swift +++ b/Sources/GitBuddyCore/Commands/ReleaseCommand.swift @@ -72,6 +72,9 @@ struct ReleaseCommand: ParsableCommand { @Flag(name: .customLong("sections"), help: "Whether the changelog should be split into sections. Defaults to false.") private var isSectioned: Bool = false + @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.") + private var useGitHubReleaseNotes: Bool = false + @Flag(name: .customLong("json"), help: "Whether the release output should be in JSON, containing more details. Defaults to false.") private var shouldUseJSONOutput: Bool = false @@ -89,7 +92,8 @@ struct ReleaseCommand: ParsableCommand { releaseTitle: releaseTitle, lastReleaseTag: lastReleaseTag, baseBranch: baseBranch, - changelogToTag: changelogToTag) + changelogToTag: changelogToTag, + useGitHubReleaseNotes: useGitHubReleaseNotes) let release = try releaseProducer.run(isSectioned: isSectioned) if shouldUseJSONOutput { diff --git a/Sources/GitBuddyCore/Release/ReleaseProducer.swift b/Sources/GitBuddyCore/Release/ReleaseProducer.swift index ea1c166..5ab1e1c 100644 --- a/Sources/GitBuddyCore/Release/ReleaseProducer.swift +++ b/Sources/GitBuddyCore/Release/ReleaseProducer.swift @@ -32,6 +32,7 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable { let lastReleaseTag: String? let changelogToTag: String? let baseBranch: String + let useGitHubReleaseNotes: Bool init( changelogPath: String?, @@ -42,7 +43,8 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable { releaseTitle: String? = nil, lastReleaseTag: String? = nil, baseBranch: String? = nil, - changelogToTag: String? = nil + changelogToTag: String? = nil, + useGitHubReleaseNotes: Bool ) throws { try Octokit.authenticate() @@ -59,6 +61,7 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable { self.lastReleaseTag = lastReleaseTag self.changelogToTag = changelogToTag self.baseBranch = baseBranch ?? "master" + self.useGitHubReleaseNotes = useGitHubReleaseNotes } @discardableResult public func run(isSectioned: Bool) throws -> Release { @@ -187,6 +190,7 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable { prerelease: \(isPrerelease) draft: false title: \(releaseTitle) + useGitHubReleaseNotes: \(useGitHubReleaseNotes) body: \(body)\n """) @@ -201,7 +205,8 @@ final class ReleaseProducer: URLSessionInjectable, ShellInjectable { name: releaseTitle, body: body, prerelease: isPrerelease, - draft: false + draft: false, + generateReleaseNotes: useGitHubReleaseNotes ) { response in switch response { case .success(let release):