Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: Service client release notes" #1782

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ struct PrepareRelease {
) throws {
let commits = try Process.git.listOfCommitsBetween("HEAD", "\(previousVersion)")

let releaseNotes = try ReleaseNotesBuilder(
let releaseNotes = ReleaseNotesBuilder(
previousVersion: previousVersion,
newVersion: newVersion,
repoOrg: repoOrg,
Expand Down
50 changes: 0 additions & 50 deletions AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Features.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,24 @@ struct ReleaseNotesBuilder {
let repoOrg: PrepareRelease.Org
let repoType: PrepareRelease.Repo
let commits: [String]
var featuresReader: FeaturesReader = FeaturesReader()


// MARK: - Build

func build() throws -> String {
let sdkChanges: [String] = buildSDKChangeSection()
let serviceClientChanges = repoType == .awsSdkSwift ? (try buildServiceChangeSection()) : []
let fullCommitLogLink = [
"\n**Full Changelog**: https://github.com/\(repoOrg.rawValue)/\(repoType.rawValue)/compare/\(previousVersion)...\(newVersion)"

func build() -> String {
let contents = [
"## What's Changed",
buildCommits(),
.newline,
"**Full Changelog**: https://github.com/\(repoOrg.rawValue)/\(repoType.rawValue)/compare/\(previousVersion)...\(newVersion)"
]
let contents = ["## What's Changed"] + serviceClientChanges + sdkChanges + fullCommitLogLink
return contents.joined(separator: .newline)
}

func buildSDKChangeSection() -> [String] {
let formattedCommits = commits
.filter { $0.hasPrefix("feat") || $0.hasPrefix("fix") }
.map { "* \($0)" }
.joined(separator: .newline)
if (!formattedCommits.isEmpty) {
return ["### Miscellaneous", formattedCommits]
}
return []
}

func buildServiceChangeSection() throws -> [String] {
let features = try featuresReader.getFeaturesFromFile()
let mapping = try featuresReader.getFeaturesIDToServiceNameDictFromFile()
return buildServiceFeatureSection(features, mapping) + buildServiceDocSection(features, mapping)
}

private func buildServiceFeatureSection(
_ features: Features,
_ mapping: [String: String]
) -> [String] {
let formattedFeatures = features.features
.filter { $0.featureMetadata.trebuchet.featureType == "NEW_FEATURE" }
.map { "* **AWS \(mapping[$0.featureMetadata.trebuchet.featureId]!)**: \($0.releaseNotes)" }
.joined(separator: .newline)
if (!formattedFeatures.isEmpty) {
return ["### Service Features", formattedFeatures]
}
return []
}

private func buildServiceDocSection(
_ features: Features,
_ mapping: [String: String]
) -> [String] {
let formattedDocUpdates = features.features
.filter { $0.featureMetadata.trebuchet.featureType == "DOC_UPDATE" }
.map { "* **AWS \(mapping[$0.featureMetadata.trebuchet.featureId]!)**: \($0.releaseNotes)" }

// Adds a preceding `*` to each commit string
// This renders the list of commits as a list in markdown
func buildCommits() -> String {
commits
.map { "* \($0)"}
.joined(separator: .newline)
if (!formattedDocUpdates.isEmpty) {
return ["### Service Documentation", formattedDocUpdates]
}
return []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ class PrepareReleaseTests: CLITestCase {
createPackageVersion(previousVersion)
createNextPackageVersion(newVersion)

let buildRequest = """
{
"features": []
}
"""
FileManager.default.createFile(atPath: "build-request.json", contents: Data(buildRequest.utf8))

let mapping = "{}"
FileManager.default.createFile(atPath: "feature-service-id.json", contents: Data(mapping.utf8))

let subject = PrepareRelease.mock(repoType: .awsSdkSwift, diffChecker: { _,_ in true })
try! subject.run()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class PackageManifestBuilderTests: XCTestCase {

let expected = """
<contents of prefix>

// MARK: - Dynamic Content

let clientRuntimeVersion: Version = "1.2.3"
Expand Down

This file was deleted.

Loading