diff --git a/IntegrationTests/UITests/IntegrationTestsUITests.xctestplan b/IntegrationTests/UITests/IntegrationTestsUITests.xctestplan index ce659871..8a18b840 100644 --- a/IntegrationTests/UITests/IntegrationTestsUITests.xctestplan +++ b/IntegrationTests/UITests/IntegrationTestsUITests.xctestplan @@ -14,6 +14,18 @@ "key" : "GITHUB_REPOSITORY", "value" : "$(GITHUB_REPOSITORY)" }, + { + "key" : "GITHUB_REF", + "value" : "$(GITHUB_REF)" + }, + { + "key" : "GITHUB_HEAD_REF", + "value" : "$(GITHUB_HEAD_REF)" + }, + { + "key" : "GITHUB_ACTIONS", + "value" : "$(GITHUB_ACTIONS)" + }, { "key" : "DD_ENV", "value" : "internal-tests" diff --git a/Sources/DatadogSDKTesting/Utils/GitInfo.swift b/Sources/DatadogSDKTesting/Utils/GitInfo.swift index 2ce06964..5446aeb2 100644 --- a/Sources/DatadogSDKTesting/Utils/GitInfo.swift +++ b/Sources/DatadogSDKTesting/Utils/GitInfo.swift @@ -32,9 +32,14 @@ struct GitInfo { commit = refData.trimmingCharacters(in: .whitespacesAndNewlines) } else { let fetchHeadPath = gitFolder.appendingPathComponent("FETCH_HEAD") - if let records = FetchHeadRecord.from(file: fetchHeadPath)? - .filter({$0.commit == head && $0.type == "branch"}), records.count > 0 { - self.branch = records.first!.ref + if let records = FetchHeadRecord.from(file: fetchHeadPath)?.filter({$0.commit == head}), + records.count > 0 + { + if let branchRef = records.first(where: { $0.type == "branch" }) { + self.branch = branchRef.ref + } else { // Seems as we have only a tag ref + self.branch = records.first!.ref + } } commit = head }