File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
_tools/changelog_generator Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 33require "optparse"
44require "json"
55
6+ REPO_NAME = "ruby-go-gem/go-gem-wrapper"
7+
68# @return [String]
79def search_git_tags
810 releases = JSON . parse ( `gh release list --json tagName` )
@@ -14,11 +16,12 @@ def search_git_tags
1416# @param after [String]
1517# @return [Array<Integer>]
1618def search_pr_numbers ( before :, after :)
17- commits = `git rev-list --merges --right-only #{ before } ...#{ after } ` . each_line . map ( &:strip )
18- commits . map do |commit |
19- commit_message = `git show -q #{ commit } `
20- commit_message =~ /Merge pull request #([0-9]+)/
21- Regexp . last_match ( 1 ) . to_i
19+ endpoint = "/repos/#{ REPO_NAME } /compare/#{ before } ...#{ after } "
20+ res = JSON . parse ( `gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" #{ endpoint } ` )
21+ res [ "commits" ] . filter_map do |commit |
22+ commit_message = commit [ "commit" ] [ "message" ]
23+
24+ Regexp . last_match ( 1 ) . to_i if commit_message =~ /Merge pull request #([0-9]+)/
2225 end
2326end
2427
You can’t perform that action at this time.
0 commit comments