Skip to content

Commit c8cc673

Browse files
authored
Suppress error when GITHUB_PERSONAL_ACCESS_TOKEN is not present
1 parent bfcf490 commit c8cc673

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
@@ -2,15 +2,17 @@ enablePlugins(Travis)
22

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

0 commit comments

Comments
 (0)