Skip to content

Scala Steward attempting to raise PRs for group branches that already have PRs #3300

Closed
@rtyley

Description

@rtyley

I'm not certain that this is Scala Steward's fault, but some pretty weird has definitely been happening to our Scala Steward runs since 10am London time today:

image

We're running Scala Steward using scala-steward-action, over about 57 repos - and for most of them (maybe 47 repos), Scala Steward is attempting to raise a new PR for a group of updates where the branch already exists.

Our scala-steward.conf defines two pullRequests.grouping, (aws and non_aws), and for both of them, the branches used by Scala Steward (update/aws & update/non_aws) are often already existing as PRs in the repos - but that isn't stopping Scala Steward from trying to raise new PRs on those branches - which GitHub rejects:

body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for guardian:update/non_aws."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

This is happening quite consistently. I would guess that somehow in the code below, the check for the existing PR on line 101 is somehow getting bypassed, leading to a new PR being created:

_ <- logger.info(s"Process update ${data.update.show}")
head = forge.listingBranch(config.tpe, data.fork, data.updateBranch)
pullRequests <- forgeApiAlg.listPullRequests(data.repo, head, data.baseBranch)
result <- pullRequests.headOption match {
case Some(pr) if pr.state.isClosed && data.update.isInstanceOf[Update.Single] =>
logger.info(s"PR ${pr.html_url} is closed") >>
deleteRemoteBranch(data.repo, data.updateBranch).as(Ignored)
case Some(pr) if !pr.state.isClosed =>
logger.info(s"Found PR ${pr.html_url}") >> updatePullRequest(data, pr.number)
case _ =>
applyNewUpdate(data).flatTap {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions