Skip to content

Commit 20a1bfd

Browse files
authored
Fix missing tags (#32)
When the GitHub Actions workflow is triggered on an event other than `triggerSiteBuild`, we don't know the depth of the last tagged commit. Therefore, we can no longer add the `depth` flag when cloning the JUnit Pioneer repo. Furthermore, this PRs improves error handling when inserting the project version. Relates to: #29 PR: #32
1 parent b896651 commit 20a1bfd

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

build.gradle

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// -----
44

55
plugins {
6-
id 'org.ajoberstar.grgit' version '4.1.1'
6+
id 'org.ajoberstar.grgit' version '4.1.1' apply false
77
}
88

99
ext {
@@ -119,16 +119,23 @@ task insertVersion() {
119119
}
120120
}
121121

122+
import org.ajoberstar.grgit.Grgit
122123
import org.ajoberstar.grgit.Tag
124+
123125
def insertProjectVersion(String project, String abbreviation) {
124-
String latestTagName = grgit
126+
List<Tag> tags = Grgit
125127
.open(dir: project)
126-
.tag.list()
128+
.tag
129+
.list()
130+
if (tags.isEmpty())
131+
throw new IllegalStateException("No tags available for ${project}.")
132+
133+
String latestTagName = tags
127134
.sort { it.commit.dateTime }
128135
.last()
129136
.name
130-
if (!latestTagName?.startsWith("v"))
131-
throw new IllegalStateException("Could not determine version of @${project}.")
137+
if (!latestTagName.startsWith("v"))
138+
throw new IllegalStateException("Could not determine version of ${project}.")
132139
String version = latestTagName.substring(1)
133140

134141
File about = file("site-source/_pages/${abbreviation}.adoc")

git-repo-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
set -e
55

66
# cloning `junit-pioneer`
7-
git clone https://github.com/junit-pioneer/junit-pioneer.git junit-pioneer --depth=10
7+
git clone https://github.com/junit-pioneer/junit-pioneer.git junit-pioneer
88
# adding worktrees `site` and `site-source`
99
git checkout master
1010
git checkout site-source

0 commit comments

Comments
 (0)