9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

build: fix grgit failsafe being unreachable (#258)

* Update build.gradle

* Update build.gradle

* Update build.gradle
This commit is contained in:
SnowCutieOwO
2024-03-13 17:59:48 +08:00
committed by GitHub
parent 501ea3f609
commit b77cf2524d

View File

@@ -166,15 +166,11 @@ logger.lifecycle("Building HuskSync ${version} by William278")
@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
// Get if there is a tag for this commit
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
if (tag != null) {
return ''
}
// Otherwise, get the last commit hash and if it's a clean head
// Get the last commit hash and if it's a clean head
if (grgit == null) {
return '-' + System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
}
// If grgit DOES exist, get tag for this commit
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
return '-' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev')
}