From 31f87a70a4aa4b6e08f2850c2a3abd3407760f08 Mon Sep 17 00:00:00 2001 From: Benjamin Maurer Date: Thu, 5 Jun 2025 11:07:00 +0200 Subject: [PATCH] Return dummy value in listBuildStatuses for Github, bc. merge check is invalid. --- .../emergence/core/vcs/github/GithubVcs.scala | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/core/src/main/scala/com/fgrutsch/emergence/core/vcs/github/GithubVcs.scala b/core/src/main/scala/com/fgrutsch/emergence/core/vcs/github/GithubVcs.scala index 85fdae76..07a52278 100644 --- a/core/src/main/scala/com/fgrutsch/emergence/core/vcs/github/GithubVcs.scala +++ b/core/src/main/scala/com/fgrutsch/emergence/core/vcs/github/GithubVcs.scala @@ -61,17 +61,12 @@ final class GithubVcs[F[_]: Temporal](using backend: SttpBackend[F, Any], settin override def listBuildStatuses(repo: Repository, pr: PullRequest): F[List[BuildStatus]] = { - val uri = - settings.apiHost.addPath("repos", repo.owner, repo.name, "commits", pr.sourceBranchHead.toString, "status") - - basicRequest - .get(uri) - .header("X-GitHub-Api-Version", "2022-11-28") - .header("Accept", "application/vnd.github+json") - .withAuthentication() - .response(asJson[BuildStatus]) - .send(backend) - .flatMap(r => TMP.fromEither(r.body.map(List(_)))) + // This used to check the build status of the PR's head commit. + // However, this is not a reliable way to get the build status of a PR. + // Often, we'd only get a `PENDING` back, which also indicates no build status is available. + // We have to only rely on the merge check. + // See: https://docs.github.com/en/rest/guides/using-the-rest-api-to-interact-with-your-git-database?apiVersion=2022-11-28#checking-mergeability-of-pull-requests + TMP.pure(List(BuildStatus(BuildStatusName("success"), BuildStatusState.Success))) } override def mergePullRequest(