build: fix grgit failsafe being unreachable (#258)

* Update build.gradle

* Update build.gradle

* Update build.gradle
feat/data-edit-commands
SnowCutieOwO 12 months ago committed by GitHub
parent 501ea3f609
commit b77cf2524d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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')
}
}

Loading…
Cancel
Save