Created
December 1, 2023 07:38
-
-
Save firewood/ded29e68663c709d0086e7241aacfacc to your computer and use it in GitHub Desktop.
show pull requests by markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'json' | |
| require 'date' | |
| fields = ['number','title','body','createdAt','url'] | |
| label = 'frontend' | |
| options = "--state closed --limit 10" | |
| options += " --label #{label}" | |
| options += ' --search "created:>2023-06-30" ' | |
| result = `gh pr list #{options} --json "#{fields.join(',')}"` | |
| json = JSON.parse(result) | |
| json.reverse.each do |row| | |
| date = DateTime.parse(row['createdAt']).new_offset('+09:00') | |
| url = row['url'] | |
| title = row['title'] | |
| body = row['body'] | |
| .split("\n") | |
| .map { |line| line.gsub(/^#/, '##') } | |
| .join("\n") | |
| puts "# #{date.strftime("%Y/%m/%d %H:%M")} #{title}" | |
| puts | |
| puts "#{url}" | |
| puts | |
| puts body | |
| puts | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment