summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-01-11 00:55:10 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-01-13 20:34:08 +0900
commit3ecffae8e81b8c508b4b964643a1468718452054 (patch)
tree7e6a8b1814c194a6aa047e0557716a1f9a2e7896 /.github
parent94d6d6d93fa40b5f8dcdda6aa0e4b300ee61085c (diff)
[DOC] Extract tool/update-NEWS-gemlist.rb
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7104
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/bundled_gems.yml30
-rw-r--r--.github/workflows/check_misc.yml25
2 files changed, 2 insertions, 53 deletions
diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml
index 3f800c6a56..66a51b1a50 100644
--- a/.github/workflows/bundled_gems.yml
+++ b/.github/workflows/bundled_gems.yml
@@ -56,35 +56,7 @@ jobs:
- name: Maintain updated gems list in NEWS
run: |
- #!ruby
- require 'json'
- news = File.read("NEWS.md")
- prev = news[/since the \*+(\d+\.\d+\.\d+)\*+/, 1]
- prevs = [prev, prev.sub(/\.\d+\z/, '')]
- %W[bundled].each do |type|
- last = JSON.parse(File.read("#{type}_gems.json"))['gems'].filter_map do |g|
- v = g['versions'].values_at(*prevs).compact.first
- g = g['gem']
- g = 'RubyGems' if g == 'rubygems'
- [g, v] if v
- end.to_h
- changed = File.foreach("gems/#{type}_gems").filter_map do |l|
- next if l.start_with?("#")
- g, v = l.split(" ", 3)
- [g, v] unless last[g] == v
- end
- changed, added = changed.partition {|g, _| last[g]}
- news.sub!(/^\*( +)The following #{type} gems? are updated\.\n+\K(?: \1\*( +).*\n)*/) do
- mark = "#{$1} *#{$2}"
- changed.map {|g, v|"#{mark}#{g} #{v}\n"}.join("")
- end or next
- news.sub!(/^\*( +)The following default gems are now bundled gems\.\n+\K(?: \1\*( +).*\n)*/) do
- mark = "#{$1} *#{$2}"
- added.map {|g, v|"#{mark}#{g} #{v}\n"}.join("")
- end or next unless added.empty?
- File.write("NEWS.md", news)
- end
- shell: ruby {0}
+ ruby tool/update-NEWS-gemlist.rb bundled
- name: Check diffs
id: diff
diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml
index f6b09ae2a9..b41b58795f 100644
--- a/.github/workflows/check_misc.yml
+++ b/.github/workflows/check_misc.yml
@@ -66,30 +66,7 @@ jobs:
- name: Maintain updated gems list in NEWS
run: |
- #!ruby
- require 'json'
- news = File.read("NEWS.md")
- prev = news[/since the \*+(\d+\.\d+\.\d+)\*+/, 1]
- prevs = [prev, prev.sub(/\.\d+\z/, '')]
- %W[default].each do |type|
- last = JSON.parse(File.read("#{type}_gems.json"))['gems'].filter_map do |g|
- v = g['versions'].values_at(*prevs).compact.first
- g = g['gem']
- g = 'RubyGems' if g == 'rubygems'
- [g, v] if v
- end.to_h
- changed = File.foreach("gems/#{type}_gems").filter_map do |l|
- next if l.start_with?("#")
- g, v = l.split(" ", 3)
- [g, v] unless last[g] == v
- end
- news.sub!(/^\*( +)The following #{type} gems? are updated\.\n+\K(?: \1\* .*\n)*/) do
- mark = "#{$1} * "
- changed.map {|g, v|"#{mark}#{g} #{v}\n"}.join("")
- end or next
- File.write("NEWS.md", news)
- end
- shell: ruby {0}
+ ruby tool/update-NEWS-gemlist.rb default
- name: Check diffs
id: diff