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

Sort tags by date before fetching release notes #134

Closed
alexcanessa opened this issue Jan 31, 2018 · 6 comments
Closed

Sort tags by date before fetching release notes #134

alexcanessa opened this issue Jan 31, 2018 · 6 comments
Assignees
Labels

Comments

@alexcanessa
Copy link
Member

GitHub APIs tags returns a list of tags ordered by name (as git tag --list does).

We have to order them per date or the functionality will break.

@alexcanessa alexcanessa self-assigned this Jan 31, 2018
@wellDan28
Copy link
Contributor

@alexcanessa you can use the github graphql api to get the result ordered by date.

For example:
{ repository(owner: "github-tools", name: "github-release-notes") { refs(refPrefix:"refs/tags/", last:100, orderBy:{field:TAG_COMMIT_DATE, direction: ASC}) { nodes { name } } } }

@wellDan28
Copy link
Contributor

@alexcanessa are you working on this issue?
can I try fixing it?

@alexcanessa
Copy link
Member Author

I've actually started looking into it, but not deeply. You're more than welcome to have a look.

Keep in mind that there is a function that gets the dates of the tags, so far used for other functionality but that could easily be implemented before in the flow and avoid this bug:

_getTagDates(tags) {
return tags.map(async tag => {
const { data: { committer } } = await this.repo.getCommit(tag.tag.commit.sha);
return {
id: tag.releaseId,
name: tag.tag.name,
date: committer.date
};
});
}

@wellDan28
Copy link
Contributor

It's look there is already a function for sorting by dates :

_sortReleasesByDate(releaseDates) {
return Array.from(releaseDates).sort((release1, release2) => new Date(release2.date) - new Date(release1.date));
}

I think the real problem is that the paging not working, as I reported in #132
The sorting is working but not on all tags are exists.

@wellDan28
Copy link
Contributor

I think that this issue is less important (after The PR for #132 will be approved)

@alexcanessa
Copy link
Member Author

Fixed in 0.17.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants