Skip to content

Commit

Permalink
Ignore git diff errors when there's no origin branch
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Nov 14, 2023
1 parent 268340f commit 46d9cd4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,22 @@ task updateVersion {
ext.createDiffFile = { ->
def file = Files.createTempFile(URLEncoder.encode(project.name, 'UTF-8'), '.diff').toFile()
def diffBase = 'refs/remotes/origin/main'
// Only run locally
if (!System.getenv('CI')) {
file.withOutputStream { out ->
exec {
commandLine 'git', 'diff', '--no-color', '--minimal', diffBase
standardOutput = out
}
file.withOutputStream { out ->
exec {
ignoreExitValue true
commandLine 'git', 'diff', '--no-color', '--minimal', diffBase
standardOutput = out
}
}
return file
}

diffCoverageReport {
afterEvaluate {
diffSource.file = createDiffFile()
// For local runs, ignore this on GitHub Actions
if (!System.getenv('CI')) {
diffSource.file = createDiffFile()
}
}

// View report at build/reports/jacoco/diffCoverage/html/index.html
Expand Down

0 comments on commit 46d9cd4

Please sign in to comment.