Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit baf108d

Browse files
authored
Merge pull request #31 from codacy/support-ci-commit-ids
Add commit identifiers for popular CIs
2 parents a4d21ba + ae90c00 commit baf108d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Dependencies._
22

33
name := "sbt-codacy-coverage"
44

5-
version := "1.2.2"
5+
version := "0.0.1-SNAPSHOT"
66

77
scalaVersion := "2.10.4"
88

src/main/scala/com/codacy/CodacyCoveragePlugin.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.codacy
22

3+
import java.io.File
4+
5+
import com.codacy.api.Language
36
import com.codacy.api.client.CodacyClient
47
import com.codacy.api.helpers.FileHelper
5-
import com.codacy.api.Language
68
import com.codacy.api.service.CoverageServices
79
import com.codacy.parsers.implementation.CoberturaParser
8-
import java.io.File
910
import sbt.Keys._
1011
import sbt._
1112

@@ -42,7 +43,17 @@ object CodacyCoveragePlugin extends AutoPlugin {
4243
codacyToken: Option[String], codacyApiBaseUrl: Option[String]): Unit = {
4344
implicit val logger: Logger = state.log
4445

45-
FileHelper.withTokenAndCommit(codacyToken, commitUUID = sys.env.get("CI_COMMIT")) {
46+
val commitUUID =
47+
sys.env.get("CI_COMMIT") orElse
48+
sys.env.get("TRAVIS_PULL_REQUEST_SHA") orElse
49+
sys.env.get("TRAVIS_COMMIT") orElse
50+
sys.env.get("DRONE_COMMIT") orElse
51+
sys.env.get("CIRCLE_SHA1") orElse
52+
sys.env.get("CI_COMMIT_ID") orElse
53+
sys.env.get("WERCKER_GIT_COMMIT")
54+
.filter(_.trim.nonEmpty)
55+
56+
FileHelper.withTokenAndCommit(codacyToken, commitUUID) {
4657
case (projectToken, commitUUID) =>
4758

4859
val reader = new CoberturaParser(Language.Scala, rootProjectDir, coberturaFile)

0 commit comments

Comments
 (0)