From c18eb921455ea35605451ddb2f5b8c93757c83c2 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 19 Mar 2026 08:59:30 +0200 Subject: [PATCH] Revert "Move CI GitHub token usage to the global git configuration" This reverts commit 519cd4052dc574877be765baed682a4ba5ee8cd8. --- Tools/Sources/Commands/CI/CI.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Tools/Sources/Commands/CI/CI.swift b/Tools/Sources/Commands/CI/CI.swift index 952921004..ff5a0b048 100644 --- a/Tools/Sources/Commands/CI/CI.swift +++ b/Tools/Sources/Commands/CI/CI.swift @@ -128,13 +128,8 @@ struct CI: ParsableCommand { // MARK: - Git static func gitConfigureGlobals() async throws { - guard let apiToken = ProcessInfo.processInfo.environment["GITHUB_TOKEN"], !apiToken.isEmpty else { - throw ValidationError("GITHUB_TOKEN environment variable is not set.") - } - try await CI.run(.name("git"), ["config", "--global", "user.name", "Element CI"]) try await CI.run(.name("git"), ["config", "--global", "user.email", "ci@element.io"]) - try await CI.run(.name("git"), ["config", "--global", "http.extraHeader", "Authorization: Bearer \(apiToken)"]) } static func gitRepositoryURL() async throws -> String { @@ -150,15 +145,20 @@ struct CI: ParsableCommand { .replacingOccurrences(of: ".git", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } - + static func gitPush(tagName: String? = nil) async throws { + guard let apiToken = ProcessInfo.processInfo.environment["GITHUB_TOKEN"], !apiToken.isEmpty + else { + throw ValidationError("GITHUB_TOKEN environment variable is not set.") + } + let repoURL = try await CI.gitRepositoryURL() if let tagName { try await CI.run(.name("git"), ["tag", tagName]) - try await CI.run(.name("git"), ["push", "https://\(repoURL)", tagName]) + try await CI.run(.name("git"), ["push", "https://\(apiToken)@\(repoURL)", tagName]) } else { - try await CI.run(.name("git"), ["push", "https://\(repoURL)"]) + try await CI.run(.name("git"), ["push", "https://\(apiToken)@\(repoURL)"]) } } }