Skip to content

Commit

Permalink
add additional logging and minor bug fix for branch construction in G…
Browse files Browse the repository at this point in the history
…itHub
  • Loading branch information
nefilim committed Feb 23, 2022
1 parent 90de0d6 commit badac50
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
arguments: |
-Psemver.develop.stage=beta
clean build
--stacktrace
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
clean build
${{ steps.stage_param.outputs.publishCommand }}
githubRelease
--stacktrace
env:
GITHUB_TOKEN: ${{ github.token }}
OSS_USER: '${{ secrets.OSS_USER }}'
Expand Down
7 changes: 4 additions & 3 deletions src/main/kotlin/io/github/nefilim/gradle/semver/Git.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ fun getGitContextProviderOperations(git: Git, config: VersionCalculatorConfig):
private val tags = git.tagMap(config.tagPrefix)

override fun currentBranch(): Option<GitRef.Branch> {
return git.currentBranchRef().flatMap {
it.shortName().map {
GitRef.Branch(it)
return git.currentBranchRef().flatMap { ref ->
ref.shortName().map {
GitRef.Branch(it, ref)
}.orNone()
}
}
Expand Down Expand Up @@ -181,6 +181,7 @@ internal fun Git.findYoungestTagOnBranchOlderThanTarget(
target: RevCommit,
tags: Tags
): Option<SemVer> {
logger.debug("pulling log for $branch refName")
return log().add(repository.exactRef(branch.refName).objectId).call()
.firstOrNull { it.commitTime <= target.commitTime && tags.containsKey(it.toObjectId()) }
.toOption()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ abstract class SemVerExtension @Inject constructor(objects: ObjectFactory, priva
logger.error("failed to find current branch, cannot calculate semver".red())
throw Exception("failed to find current branch")
}, { currentBranch ->
logger.semver("current branch: $currentBranch")
val calculator = getTargetBranchVersionCalculator(ops, config, context, currentBranch)
logger.info("semver configuration while calculating version: $config")

Expand Down

0 comments on commit badac50

Please sign in to comment.