Hey!
I would like to get list of all PRs since tag.
Based on https://hub.github.com/hub-pr.1.html - it's possible to use --head or --branch, but not tag.
When I try
LAST_MAJOR_VERSION=$(git describe --abbrev=0 --tags)
echo "$(hub pr list -h $LAST_MAJOR_VERSION -s closed -L 200)"
it shows nothing even tho git describe --abbrev=0 --tags
shows correctly last production tag.
This would be super useful for creating changelogs as it could give me list of all closed PRs since last release.
Any idea or extension to hub pr list
coming?
Thank you! :)
Interesting idea! This is not possible with hub. We can only return the results that GitHub API provides us, and the GitHub API has no functionality to query PRs based on whether they were merged into a branch that eventually got a release based off it. The --head
argument merely queries PRs based on the name of their head branch at the time that the PR was opened. The names of those branches have no connection to the git tag that eventually gets created.
You can potentially use git to answer your question:
git log --merges --grep 'Merge pull request' --pretty=format:%s v1.2.0..v1.3.0
This lists all merges happening between releases v1.2.0 – v1.3.0 and lists those that start with "Merge pull request #...". You can use that to generate a list of merged PRs for a specific release. Note that this method is not perfect, but gets close to what you want.
Most helpful comment
Interesting idea! This is not possible with hub. We can only return the results that GitHub API provides us, and the GitHub API has no functionality to query PRs based on whether they were merged into a branch that eventually got a release based off it. The
--head
argument merely queries PRs based on the name of their head branch at the time that the PR was opened. The names of those branches have no connection to the git tag that eventually gets created.You can potentially use git to answer your question:
This lists all merges happening between releases v1.2.0 – v1.3.0 and lists those that start with "Merge pull request #...". You can use that to generate a list of merged PRs for a specific release. Note that this method is not perfect, but gets close to what you want.