Skip to content

Commit 5788179

Browse files
authored
Merge pull request #15 from ThoughtWorksInc/features/sbt-best-practice-deploy
Suppress error when GITHUB_PERSONAL_ACCESS_TOKEN is not present
2 parents d73033d + c8cc673 commit 5788179

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

deploy.sbt.disabled

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ enablePlugins(SonatypeRelease)
44

55
lazy val secret = project.settings(publishArtifact := false).in {
66
val secretDirectory = file(sourcecode.File()).getParentFile / "secret"
7-
IO.delete(secretDirectory)
8-
org.eclipse.jgit.api.Git
9-
.cloneRepository()
10-
.setURI("https://github.com/ThoughtWorksInc/tw-data-china-continuous-delivery-password.git")
11-
.setDirectory(secretDirectory)
12-
.setCredentialsProvider(
13-
new org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider(sys.env("GITHUB_PERSONAL_ACCESS_TOKEN"), "")
14-
)
15-
.call()
16-
.close()
7+
sys.env.get("GITHUB_PERSONAL_ACCESS_TOKEN").foreach { token =>
8+
IO.delete(secretDirectory)
9+
org.eclipse.jgit.api.Git
10+
.cloneRepository()
11+
.setURI("https://github.com/ThoughtWorksInc/tw-data-china-continuous-delivery-password.git")
12+
.setDirectory(secretDirectory)
13+
.setCredentialsProvider(
14+
new org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider(sys.env.get(token, "")
15+
)
16+
.call()
17+
.close()
18+
}
1719
secretDirectory
1820
}

0 commit comments

Comments
 (0)