From c957e83efcd40d7734e640215e348025cc9059d4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:39:23 +0000 Subject: [PATCH 1/2] Initial plan From e38281ccfcc5ec367d8732da61eb26ee0b9180ac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:46:40 +0000 Subject: [PATCH 2/2] fix: use empty changelog when latest previous build has empty commits Agent-Logs-Url: https://github.com/PaperMC/fill-gradle/sessions/e75bc6cb-6de8-4115-b965-68ba02ee0e7c Co-authored-by: jpenilla <11360596+jpenilla@users.noreply.github.com> --- .../fill/gradle/task/PublishToFillTask.java | 9 ++++ .../gradle/task/PublishToFillTaskTests.java | 50 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/test/java/io/papermc/fill/gradle/task/PublishToFillTaskTests.java diff --git a/src/main/java/io/papermc/fill/gradle/task/PublishToFillTask.java b/src/main/java/io/papermc/fill/gradle/task/PublishToFillTask.java index 339c37f..44051a8 100644 --- a/src/main/java/io/papermc/fill/gradle/task/PublishToFillTask.java +++ b/src/main/java/io/papermc/fill/gradle/task/PublishToFillTask.java @@ -212,6 +212,10 @@ private List gatherCommits(Git git, FillExtension extension) { final List builds = this.fetchPreviousBuilds(extension); if (!builds.isEmpty()) { + if (hasLatestBuildWithEmptyCommits(builds)) { + return commits; + } + // not every build might have commits, we have to find the last one that did have some BuildResponse lastBuildWithCommits = null; for (final BuildResponse build : builds) { @@ -242,6 +246,11 @@ private List gatherCommits(Git git, FillExtension extension) { return commits; } + @VisibleForTesting + static boolean hasLatestBuildWithEmptyCommits(final List builds) { + return !builds.isEmpty() && builds.getFirst().commits().isEmpty(); + } + private boolean tryMarkPreviousBuildCommit(final Git git, final RevWalk revWalk, final RevCommit currentCommit, final Commit lastCommit) throws IOException { final ObjectId lastBuildObjectId = git.getRepository().resolve(lastCommit.sha()); if (lastBuildObjectId == null) { diff --git a/src/test/java/io/papermc/fill/gradle/task/PublishToFillTaskTests.java b/src/test/java/io/papermc/fill/gradle/task/PublishToFillTaskTests.java new file mode 100644 index 0000000..ecff8bb --- /dev/null +++ b/src/test/java/io/papermc/fill/gradle/task/PublishToFillTaskTests.java @@ -0,0 +1,50 @@ +/* + * Copyright 2024 PaperMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.papermc.fill.gradle.task; + +import io.papermc.fill.model.BuildChannel; +import io.papermc.fill.model.response.v3.BuildResponse; +import java.time.Instant; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class PublishToFillTaskTests { + @Test + void latestBuildWithEmptyCommitsReturnsTrue() { + final BuildResponse latest = new BuildResponse(2, Instant.EPOCH, BuildChannel.STABLE, List.of(), Map.of()); + final BuildResponse older = new BuildResponse(1, Instant.EPOCH, BuildChannel.STABLE, List.of(), Map.of()); + + assertTrue(PublishToFillTask.hasLatestBuildWithEmptyCommits(List.of(latest, older))); + } + + @Test + void latestBuildWithCommitsReturnsFalse() { + final BuildResponse latest = new BuildResponse(2, Instant.EPOCH, BuildChannel.STABLE, List.of( + new io.papermc.fill.model.Commit("abc", Instant.EPOCH, "msg") + ), Map.of()); + + assertFalse(PublishToFillTask.hasLatestBuildWithEmptyCommits(List.of(latest))); + } + + @Test + void emptyBuildListReturnsFalse() { + assertFalse(PublishToFillTask.hasLatestBuildWithEmptyCommits(List.of())); + } +}