From f28920302681b29681cd4f862da5c9ef829988ad Mon Sep 17 00:00:00 2001 From: Joan Goyeau Date: Wed, 20 Nov 2024 15:25:55 -0500 Subject: [PATCH] Support Basic Auth for GitHub again --- .github/workflows/ci.yml | 2 +- build.sbt | 6 ++++-- .../org/scalasteward/core/forge/ForgeAuthAlg.scala | 14 +++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b0c4249d..e97a45945 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: - uses: coursier/setup-action@v1 with: - apps: scalafmt + apps: 'scalafmt:3.8.3' - name: Build project run: sbt '++ ${{ matrix.scala }}' validate diff --git a/build.sbt b/build.sbt index 8db778a81..39c11a582 100644 --- a/build.sbt +++ b/build.sbt @@ -54,8 +54,10 @@ ThisBuild / githubWorkflowPublish := Seq( ThisBuild / githubWorkflowJavaVersions := Seq("21", "17", "11").map(JavaSpec(Temurin, _)) ThisBuild / githubWorkflowBuild := Seq( - WorkflowStep - .Use(UseRef.Public("coursier", "setup-action", "v1"), params = Map("apps" -> "scalafmt")), + WorkflowStep.Use( + UseRef.Public("coursier", "setup-action", "v1"), + params = Map("apps" -> "scalafmt:3.8.3") + ), WorkflowStep.Sbt(List("validate"), name = Some("Build project")), WorkflowStep.Use( UseRef.Public("codecov", "codecov-action", "v3"), diff --git a/modules/core/src/main/scala/org/scalasteward/core/forge/ForgeAuthAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/forge/ForgeAuthAlg.scala index ac851d9b3..b04acc455 100644 --- a/modules/core/src/main/scala/org/scalasteward/core/forge/ForgeAuthAlg.scala +++ b/modules/core/src/main/scala/org/scalasteward/core/forge/ForgeAuthAlg.scala @@ -54,11 +54,15 @@ object ForgeAuthAlg { config.gitCfg.gitAskPass ) case GitHub => - val gitHub = - config.githubApp.getOrElse( - throw new IllegalArgumentException("GitHub app configuration is missing") - ) - new GitHubAuthAlg(config.forgeCfg.apiHost, gitHub.id, gitHub.keyFile) + config.githubApp match { + case Some(gitHub) => new GitHubAuthAlg(config.forgeCfg.apiHost, gitHub.id, gitHub.keyFile) + case None => + new BasicAuthAlg( + config.forgeCfg.apiHost, + config.forgeCfg.login, + config.gitCfg.gitAskPass + ) + } case GitLab => new GitLabAuthAlg(config.forgeCfg.apiHost, config.forgeCfg.login, config.gitCfg.gitAskPass) case Gitea =>