Skip to content

Commit

Permalink
Merge pull request #4690 from galaxyproject/dojo-delta
Browse files Browse the repository at this point in the history
send news to goats
  • Loading branch information
hexylena authored Feb 5, 2024
2 parents c464526 + 2c42ce2 commit d868626
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _plugins/gtn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def get_default_link(material)
end

def group_icons(icons)
icons.group_by{|k, v| v}.map{|k, v| [k, v.map{|z|z[0]} ]}.to_h.invert
icons.group_by { |_k, v| v }.transform_values { |v| v.map { |z| z[0] } }.invert
end
end
end
Expand Down
16 changes: 15 additions & 1 deletion bin/news.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
server: 'https://matrix.org',
room: '!yuLoaCWKpFHkWPmVEO:gitter.im',
}
'wg-goat' => {
server: 'https://matrix.org',
room: '!UQXYBSjdrLHcWgegmg:gitter.im',
}
}
# rubocop:enable Style/GlobalVars
#
Expand Down Expand Up @@ -148,7 +152,7 @@ def format_tutorials(added, modified, kind: 'tutorials', updates: true)
output
end
def build_news(data, filter: nil, updates: true)
def build_news(data, filter: nil, updates: true, only_news: false)
infix = filter.nil? ? '' : titleize(filter)
output = "# GTN #{infix} News for #{NOW.strftime('%b %d')}"
newsworthy = false
Expand All @@ -158,6 +162,11 @@ def build_news(data, filter: nil, updates: true)
newsworthy |= format_news(data[:added][:news]).length.positive?
end
if only_news
return [output, newsworthy]
end
o = format_tutorials(
data[:added][:tutorials].select { |n| filter.nil? || n[:path] =~ %r{topics/#{filter}} },
data[:modified][:tutorials].select { |n| filter.nil? || n[:path] =~ %r{topics/#{filter}} },
Expand Down Expand Up @@ -252,5 +261,10 @@ def send_news(output, options, channel: 'default')
send_news(output, options, channel: channel)
end

# Single Cell
output, newsworthy = build_news(data, filter: 'single-cell', updates: false)
send_news(output, options, channel: 'single-cell') if newsworthy

# GOATS: Rss/news only.
output, newsworthy = build_news(data, only_news: true)
send_news(output, options, channel: 'wg-goat') if newsworthy

0 comments on commit d868626

Please sign in to comment.