Skip to content

Commit

Permalink
fix: catch exception when get git repo info failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwzhan committed Apr 9, 2024
1 parent 575a8c5 commit 0f0a18a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ ext {
ossrhPassword="xxx"
}

repo = grgit.open()
date = new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
branch = repo.branch.getCurrent().getName()
commit = repo.head().getAbbreviatedId(40)
branch = "none"
commit = "none"
try {
repo = grgit.open()
branch = repo.branch.getCurrent().getName()
commit = repo.head().getAbbreviatedId(40)
} catch (Exception e) {
logger.info(' Not a git project ')
}
}

// Test related configuration
Expand Down

0 comments on commit 0f0a18a

Please sign in to comment.