GithubHelp home page GithubHelp logo

Comments (3)

rtyley avatar rtyley commented on August 25, 2024

This appears to because the head string used by listPullRequests() (which is supposed to be finding us the existing PRs) is not being accepted by the GitHub API.

We're sending head=guardian/facia-scala-client%3Aupdate/aws, which is returning 0 results. On the other hand, if I manually make the request to the GitHub API, with head=update/aws, I get results:

def listPullRequests(repo: Repo, head: String, base: Branch): Uri =
pulls(repo)
.withQueryParam("head", head)

% curl --silent "https://api.github.com/repos/guardian/facia-scala-client/pulls?head=guardian/facia-scala-client%3Aupdate/aws&base=main&state=all" | head
[

]
% curl --silent "https://api.github.com/repos/guardian/facia-scala-client/pulls?head=update/aws&base=main&state=all" | head
[
  {
    "url": "https://api.github.com/repos/guardian/facia-scala-client/pulls/307",
    "id": 1747950527,
    "node_id": "PR_kwDOATw1z85oL5u_",
    "html_url": "https://github.com/guardian/facia-scala-client/pull/307",
    "diff_url": "https://github.com/guardian/facia-scala-client/pull/307.diff",
    "patch_url": "https://github.com/guardian/facia-scala-client/pull/307.patch",
    "issue_url": "https://api.github.com/repos/guardian/facia-scala-client/issues/307",
    "number": 307,

The documentation for the API endpoint says:

head string
Filter pulls by head user or head organization and branch name in the format of user:ref-name or organization:ref-name. For example: github:new-script-format or octocat:test-branch.

There's nothing in there that to suggest that we can include the repo name as well (ie. guardian/facia-scala-client%3A)...

from scala-steward.

rtyley avatar rtyley commented on August 25, 2024

The head name is constructed in listingBranch(), which is code that does not appear to have changed much recently...

def listingBranch(forgeType: ForgeType, fork: Repo, updateBranch: Branch): String =
forgeType match {
case GitHub =>
s"${fork.owner}/${fork.repo}:${updateBranch.name}"
case GitLab | Bitbucket | BitbucketServer | AzureRepos | Gitea =>
updateBranch.name
}

The repo name does seem redundant, as the path in the REST API request already contains /repos/{owner}/{repo}/pulls, giving the original repo, and GitHub only allows one fork of a repo per organisation or user, so including the user/org in the prefix should be sufficient to uniquely identify a fork.

It does look as though, in the past with #649 in 2019, the Scala Steward code deliberately did use the repo name in the head parameter, so it probably worked at that point.

from scala-steward.

adamw avatar adamw commented on August 25, 2024

Thanks for investigating this! I'm getting tens of emails every night for a couple of days now, because of failed steward actions. And I see that even a PR is there ❤️

from scala-steward.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.