fix(build): allow detached git HEAD

This commit is contained in:
rushiiMachine 2025-05-25 13:48:08 -07:00
parent 7c2a422094
commit 297ced7a2a
No known key found for this signature in database
GPG key ID: DCBE5952BB3B6420
2 changed files with 3 additions and 4 deletions

View file

@ -29,5 +29,4 @@ jobs:
with:
name: app
if-no-files-found: error
path: |
app/build/outputs/apk/debug/app-debug.apk
path: app/build/outputs/apk/debug/app-debug.apk

View file

@ -8,9 +8,9 @@ plugins {
alias(libs.plugins.kotlin.serialization)
}
val gitCurrentBranch = providers.execIgnoreCode("git", "symbolic-ref", "--short", "HEAD")
val gitCurrentBranch = providers.execIgnoreCode("git", "symbolic-ref", "--quiet", "--short", "HEAD").takeIf { it.isNotEmpty() }
val gitLatestCommit = providers.execIgnoreCode("git", "rev-parse", "--short", "HEAD")
val gitHasLocalCommits = providers.execIgnoreCode("git", "log", "origin/$gitCurrentBranch..HEAD").isNotEmpty()
val gitHasLocalCommits = gitCurrentBranch?.let { providers.execIgnoreCode("git", "log", "origin/$gitCurrentBranch..HEAD").isNotEmpty() } ?: false
val gitHasHasLocalChanges = providers.execIgnoreCode("git", "status", "-s").isNotEmpty()
android {