Skip to content

Commit

Permalink
Merge pull request #4467 from galaxyproject/bear-inanga
Browse files Browse the repository at this point in the history
Remove updates from SC news
  • Loading branch information
nomadscientist authored Nov 1, 2023
2 parents c2783f2 + c803b08 commit 9dcd866
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def self.check_bolded_heading(contents)
end

def self.zenodo_api(contents)
find_matching_texts(contents, /(zenodo\.org\/api\/files\/)/)
find_matching_texts(contents, %r{(zenodo\.org/api/files/)})
.map do |idx, _text, selected|
ReviewDogEmitter.error(
path: @path,
Expand Down Expand Up @@ -723,7 +723,7 @@ def self.fix_md(contents)
*check_bad_heading_order(contents),
*check_bolded_heading(contents),
*snippets_too_close_together(contents),
*zenodo_api(contents),
*zenodo_api(contents)
]
end

Expand Down
22 changes: 15 additions & 7 deletions bin/news.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,27 @@ def format_news(news)
output
end

def format_tutorials(added, modified, kind: 'tutorials')
def format_tutorials(added, modified, kind: 'tutorials', updates: true)
output = ''
output += "\n\n## #{added.length + modified.length} #{kind}!" if added.length.positive? || modified.length.positive?
count = added.length
if updates
count += modified.length
end
output += "\n\n## #{count} #{kind}!" if count.positive?

if added.length.positive?
output += "\n\nNew #{kind}:\n\n"
output += added.map { |n| n[:md] }.join("\n").gsub(/^/, '- ')
end

if modified.length.positive?
if updates && modified.length.positive?
output += "\n\nUpdated #{kind}:\n\n"
output += modified.map { |n| n[:md] }.join("\n").gsub(/^/, '- ')
end
output
end

def build_news(data, filter: nil)
def build_news(data, filter: nil, updates: true)
infix = filter.nil? ? '' : titleize(filter)
output = "# GTN #{infix} News for #{NOW.strftime('%b %d')}"
newsworthy = false
Expand All @@ -150,7 +154,8 @@ def build_news(data, filter: nil)

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}} }
data[:modified][:tutorials].select { |n| filter.nil? || n[:path] =~ %r{topics/#{filter}} },
updates: updates
)

output += o
Expand All @@ -159,7 +164,8 @@ def build_news(data, filter: nil)
o = format_tutorials(
data[:added][:slides].select { |n| filter.nil? || n[:path] =~ %r{topics/#{filter}} },
data[:modified][:slides].select { |n| filter.nil? || n[:path] =~ %r{topics/#{filter}} },
kind: 'slides'
kind: 'slides',
updates: updates
)
output += o
newsworthy |= o.length.positive?
Expand Down Expand Up @@ -214,7 +220,9 @@ def send_news(output, options, channel: 'default')
end
end
else
puts "=============="
puts output
puts "=============="
end
end

Expand All @@ -224,5 +232,5 @@ def send_news(output, options, channel: 'default')
send_news(output, options, channel: channel)
end

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

0 comments on commit 9dcd866

Please sign in to comment.