Refined-github: Link to "What changed since the previous release?"

Created on 8 Jan 2018  路  25Comments  路  Source: sindresorhus/refined-github

Issuehunt badges

Example: https://github.com/parcel-bundler/parcel/releases

Can you tell what each release includes? GitHub links to the tagged commit but that's rather useless

Wouldn't it make sense to list the commits between each tag/release (in chronological order).

This is the link that should appear on v1.4.1: https://github.com/parcel-bundler/parcel/compare/v1.4.0...v1.4.1

Without any fetches we can show the link on

hardikmodha earned $80.00 by resolving this issue!

Rewarded on Issuehunt Please! 鈾ワ笌 enhancement help wanted

All 25 comments

I think this is similar to that old discussion: https://github.com/sindresorhus/refined-github/pull/395#issuecomment-301189407 Scratch that, I meant a different discussion, but couldn't find it.

馃憤

Without any fetches we can show the link on

We now use the API much more, so we can use the API for this feature too.

@issuehunt has funded $80.00 to this issue.


@bfred-it I was going through the GitHub GraphQL API to fetch the release details. I ran the following query,


{
  parcel: repository(name: "parcel", owner: "parcel-bundler") {
    releases(last: 5) {
      edges {
        cursor
        node {
          tagName
        }
      }
    }
  }
  react: repository(name: "react", owner: "Facebook") {
    releases(last: 5) {
      edges {
        cursor
        node {
          tagName
        }
      }
    }
  }
}

I was able to fetch the details for "react" but the API returned 0 results for the "parcel". I also tried to fetch details for a single release by passing the tag name but the result was still the same. Is there something that I missed or it's a glitch on GitHub's end?

Update: I also tried the REST API and I'm not able to fetch the release details for "parcel".

https://api.github.com/repos/parcel-bundler/parcel/releases

Parcel only uses tags, not releases. This feature should only query releases

Also why are you querying two repos at the same time?

If it makes things easier (or cheaper) you probably only need to get the previous release related to the last one on the page (or the only one) since the other ones are already available.

Parcel only uses tags, not releases. This feature should only query releases

How can we differentiate whether it's the release or just a tag?

Also why are you querying two repos at the same time?

It was just an example.

If it makes things easier (or cheaper) you probably only need to get the previous release related to the last one on the page (or the only one) since the other ones are already available.

Definitely, That's the better approach. I was just trying out the GitHub GraphQL API for releases and encountered this behavior.

How can we differentiate whether it's the release or just a tag?

I think I found an answer. I found that for the tags class name is release-timeline-tags release-entry and for the releases, the class name is release-entry. Is it the way we are gonna differentiate?

How can we differentiate whether it's the release or just a tag?

All releases have a tag and the URL isn't different. Just query the tag

@bfred-it We can achieve it without using the GraphQL API. We can load the next page in using include-fragment and extract the tag details from that. It would be much simpler, IMO. How about that? Another thing, I tried the API approach but I'm not able to accomplish it in a single API call. Is there any more efficient way to fetch the next tag?

Yes, if it can't be determined with a single API call, then you can use fetchDom to load the next page

This is the link that should appear on v1.4.1: parcel-bundler/[email protected]

@bfred-it Don't you think it would make it hard to visit individual release pages like /release/tag/v1.4.0?

The ... link is what this feature request is about, but I guess we could /also/ add a link to the previous tag.

By the way, I don鈥檛 think you can reach the previous tag from the single tag page, you might _have to_ use the API

The ... link is what this feature request is about, but I guess we could /also/ add a link to the previous tag.

Sorry but it's still little unclear to me. The feature will work on /releases and /tags both pages. Right?

In the following screenshot, where should this link appear?

Screen Shot 2019-04-28 at 10 10 20 AM

Are we supposed to add this ... if it's missing or I'm getting it all wrong?

By the way, I don鈥檛 think you can reach the previous tag from the single tag page, you might have to use the API

Yeah, Seems like it would be difficult without using the API. I tried passing some query parameters on listing page to see if there is any way to go back but couldn't find one.

Show just ... link on:

Show ... and prev/next navigation on:

Technically the prev/next navigation is a separate feature with a separate UI, but it _could_ be part of this feature if they both depends on the same API call (or they might just share the same cache)

I'd focus on the regular ... link for this issue and later expand the feature if desired.

One thing to keep in mind is, as seen on the parcel repo, they have multiple tags on the same commit, so "the previous tag" is not necessarily "the one below it".

If not too complex (and if this is a standard many repos follow), there could be smart specific links like

If too complex, it should at least make sure "the previous tag" doesn't point to the same commit. e.g.

One thing to keep in mind is, as seen on the parcel repo, they have multiple tags on the same commit, so "the previous tag" is not necessarily "the one below it".

Yes, I noticed this thing. We can compare the commit hash for the release/tag and if they are same, we can skip them or better we can show the compare link to the previous release which is having different commit hash.

If not too complex (and if this is standard many repos follow), there could be smart specific links like
[email protected]@1.12.3 on parcel-bundler tags
@parcel/[email protected]...@parcel/integration[email protected] on @parcel/integration-tests tags.

If they are on the same page, we can show but if they are on different pages, it won't be easy. Not sure if there is a way to get the tags having the specific prefix.

e.g. @parcel/[email protected]. I tried the GitHub object with expression and refs but doesn't return what we want and we might have to call API multiple times to get the result we want.

Maybe I can just fetch all the tags and perform filtering on the client side.

Ideally you would get the last few tags starting from X and then filter them

Starting from as in, tag text starting with the particular prefix or tags after some particular tag?

Because I tried the API and I'm not able to filter the tag starting with the particular prefix.

Also, for pagination, there seems no way to say I want 5 tags only after "v1.10.1" or by ID. I'll have to fetch the tags first to get the cursor and then only I can navigate. back and forth.

Found an API https://developer.github.com/v3/git/refs/#example-matching-a-partial-branch-name. We can request tags of a particular namespace.

e.g.

https://api.github.com/repos/parcel-bundler/parcel/git/refs/tags/@parcel/integration-tests

and

https://api.github.com/repos/parcel-bundler/parcel/git/refs/tags/@parcel/watcher

Now the question is, How should we use this information and proceed?

  1. Should we only use the API for namespaced tags? For the rest, we can rely on our basic approach as we have the tag details present on the page itself.

  2. If we query API for tags of specific namespace then if namespaces are many then we'll have to fire multiple API requests.

  3. If we query the latest 100 tags. We have the necessary information now to query the next batch. Now if we need we can query for another batch of 100 and continue. The number of API requests may increase as the number of tags.

What do you think @bfred-it?

1. Should we only use the API for namespaced tags? For the rest, we can rely on our basic approach as we have the tag details present on the page itself.

Forget namespaced tags for a moment, how do you plan to get "the previous tag" on a single tag page?

Well, Initially, I investigated but I couldn't find a direct way to fetch the previous tag details. I found a way but it _is_ little convoluted.

  1. Let say I want to get the previous tag of [email protected].

So I make a request on https://github.com/parcel-bundler/parcel/[email protected]. (Basically, https://github.com/parcel-bundler/parcel/releases?after=<tag_name_from_single_page>

I will get the page in response which will contain pagination links. I can extract the link of the _previous page_ and _next page_. From this link, I can get the previous/next tag.

It won't work for the last tag. and for the cases when the releases are only on a single page.

  1. Brute force approach. If we have the list we can find the previous tag.

Do you have any other approaches in mind? @bfred-it

Ok, then only fetch that page: https://github.com/parcel-bundler/parcel/[email protected]

  • ignore the pagination in it, let's not add prev/next for now
  • if you want to add prefix-aware links (@parcel/integration-tests@***), only look in that page. If none are found, ignore the tag or just use the previous non-prefix-aware tag

If we really want to add a Next link we need to find a solution that does not require multiple consecutive fetches (whether it's the pagination link or the brute force). But for now we can ignore it

@sindresorhus has rewarded $72.00 to @hardikmodha. See it on IssueHunt

  • :moneybag: Total deposit: $80.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $8.00
Was this page helpful?
0 / 5 - 0 ratings

Related issues

olso picture olso  路  3Comments

fregante picture fregante  路  3Comments

hkdobrev picture hkdobrev  路  3Comments

MilesBHuff picture MilesBHuff  路  3Comments

shivapoudel picture shivapoudel  路  3Comments