Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new APIs in unreleased-commits #6094

Closed
yakov116 opened this issue Oct 20, 2022 · 4 comments
Closed

Use new APIs in unreleased-commits #6094

yakov116 opened this issue Oct 20, 2022 · 4 comments
Labels
help wanted meta Related to Refined GitHub itself

Comments

@yakov116
Copy link
Member

Description

Github just added the ability to compare an oid to a branch and get the ahead count.

{
  repository(owner: "refined-github", name: "refined-github") {
    ref(qualifiedName: "main") {
      compare(headRef: "5e50f67") {
        behindBy
      }
    }
  }
}

https://docs.github.com/en/graphql/overview/changelog#schema-changes-for-2022-10-18

Screenshot

No response

Example URLs

https://github.com/refined-github/refined-github

@yakov116 yakov116 added the meta Related to Refined GitHub itself label Oct 20, 2022
@fregante
Copy link
Member

Excellent! Is this useful for "update PR base branch" too?

@fregante
Copy link
Member

Also authors can now manually set the latest tag, we can ask for it: https://github.blog/changelog/2022-10-21-explicitly-set-the-latest-release/

@fregante fregante changed the title Use graphQL Compare in latest-tag-button Use new APIs in latest-tag-button Oct 21, 2022
@fregante fregante changed the title Use new APIs in latest-tag-button Use new APIs in unreleased-commits Apr 26, 2023
@fregante
Copy link
Member

@fregante
Copy link
Member

fregante commented Jun 1, 2023

To use this new API we have to know:

  • the latest tag
  • the latest commit on the default branch

We can know both in one API call, but then we have to use them to make a new API call to use compare()

In contrast, our current API call gets both information at once and then we use to calculate the behindBy

export const getRepoPublishState = cache.function('tag-ahead-by', async (): Promise<RepoPublishState> => {

I mentioned this API in a comment, maybe we can use it in the future 3d8507c

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted meta Related to Refined GitHub itself
Development

No branches or pull requests

2 participants