From 4d76f7fc6dc28800ccc926b6dfb7163a56ad9fbc Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Tue, 16 Apr 2024 12:00:53 +0200 Subject: [PATCH] Exclude more commits --- tools/changelog.main.kts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/changelog.main.kts b/tools/changelog.main.kts index 74beef95d0..7056ef7f21 100644 --- a/tools/changelog.main.kts +++ b/tools/changelog.main.kts @@ -61,6 +61,8 @@ val normal = entries.ofType(Type.Normal) val prereleaseFixes = entries.ofType(Type.PrereleaseFix) val unknown = entries.ofType(Type.Unknown) +println("\n# CHANGELOG") + println( buildString { append("_Changes since ${commitToVersion(firstCommit)}_\n") @@ -144,14 +146,16 @@ fun entriesForRepo(repo: String): List { .commits }.toSet() - val excludedCommitMessages = fetchPagedUntilEmpty { page -> + fun GitHubCompareResponse.CommitEntry.commitId() = repoNumberForCommit(this)?.toString() ?: sha + + val excludedCommitIds = fetchPagedUntilEmpty { page -> request("https://api.github.com/repos/$repo/compare/$excludeFirstCommit...$excludeLastCommit?per_page=1000&page=$page") .commits - .map { it.commit.message } + .map { it.commitId() } }.toSet() // Exclude cherry-picks with the same message (they have a different SHA, we can compare by it) - val nonCherrypickedCommits = commits.filter { it.commit.message !in excludedCommitMessages } + val nonCherrypickedCommits = commits.filter { it.commitId() !in excludedCommitIds } return nonCherrypickedCommits .map { changelogEntryFor(it, prForCommit(it)) } @@ -254,6 +258,7 @@ fun String.execCommand(workingDir: File = File(".")): String? { inline fun request( url: String ): T = exponentialRetry { + println("Request $url") val connection = URL(url).openConnection() connection.setRequestProperty("User-Agent", "Compose-Multiplatform-Script") if (token != null) {