Skip to content

Commit

Permalink
Merge pull request galaxyproject#5576 from galaxyproject/blue-coho
Browse files Browse the repository at this point in the history
Reviewer contribution role
  • Loading branch information
shiltemann authored Dec 2, 2024
2 parents 6bfab2c + df572bc commit 0362bc0
Show file tree
Hide file tree
Showing 20 changed files with 201 additions and 32 deletions.
26 changes: 25 additions & 1 deletion CONTRIBUTORS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ davebx:
name: Dave B.
joined: 2021-06

davelopez:
name: David López
joined: 2021-10

dbrites:
name: Daniela Brites
joined: 2022-03
Expand Down Expand Up @@ -1518,6 +1522,14 @@ marziacremona:
email: [email protected]
joined: 2018-02

matuskalas:
name: Matúš Kalaš
joined: 2024-06

mkuzak:
name: Mateusz Kuzak
joined: 2019-10

mateeullah905:
name: Matee Ullah
email: [email protected]
Expand Down Expand Up @@ -1624,7 +1636,7 @@ miaomiaozhou88:
joined: 2020-12
orcid: 0000-0003-4426-1758

michelemaroni89:
michelemaroni:
name: Michele Maroni
joined: 2019-07

Expand Down Expand Up @@ -1773,6 +1785,10 @@ NickSto:
twitter: NickStoler
joined: 2018-07

njall:
name: Niall Beard
joined: 2019-02

nomadscientist:
name: Wendi Bacon
email: [email protected]
Expand Down Expand Up @@ -1867,6 +1883,10 @@ otatadeabigail:
name: Otatade Abigail
joined: 2021-10

OlegZharkov:
name: Oleg Zharkov
joined: 2021-06

pajanne:
name: Anne Pajon
joined: 2017-09
Expand Down Expand Up @@ -2516,6 +2536,10 @@ twishigulati:
github: false
joined: 2021-11

tuncK:
name: Tunc Kayikcioglu
joined: 2023-10

valentinmarcon:
name: Valentin Marcon
joined: 2017-09
Expand Down
6 changes: 6 additions & 0 deletions _includes/contributor-badge.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
{%- else -%}
{%- assign contributor_badge_entity = site | fetch_contributor: include.id -%}
{%- assign name = contributor_badge_entity.short_name | default: contributor_badge_entity.name | default: include.id -%}
{% if include.small %}
<a href="{{ site.baseurl }}/hall-of-fame/{{ include.id }}/" class="contributor-badge contributor-{{ include.id }}">
{{ contributor_badge_entity | fetch_entity_avatar:include.id, 36 }}
</a>
{% else %}
<a href="{{ site.baseurl }}/hall-of-fame/{{ include.id }}/" class="contributor-badge contributor-{{ include.id }}">
{%- if contributor_badge_entity.orcid -%}<img src="{% link assets/images/orcid.png %}" alt="orcid logo" width="36" height="36"/>{%- endif -%}
{{ contributor_badge_entity | fetch_entity_avatar:include.id, 36 }}
Expand All @@ -11,4 +16,5 @@
{%- include _includes/contributor-human-icons.html activity=include.activity -%}
{%- endif -%}
</a>
{% endif %}
{%- endif -%}
2 changes: 2 additions & 0 deletions _includes/contributor-human-icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<abbr title="This person managed and provided infrastructure to the GTN or for training purposes">🖥</abbr>
{% elsif include.activity == "testing" %}
<abbr title="This person tested the tutorial to ensure it works correctly for students, or reported issues with the tutorial.">⚙️</abbr>
{% elsif include.activity == "reviewing" %}
<abbr title="This person reviewed this material for accuracy and correctness">🧐</abbr>
{% elsif include.activity == "ux" %}
<abbr title="This person contributed UX or Design improvements to this tutorial or the GTN as a whole"></abbr>
{% elsif include.activity == "funding" %}
Expand Down
9 changes: 9 additions & 0 deletions _includes/contributor-list2.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@
</tr>
{% endif %}

{% if include.contributors.reviewing %}
<tr class="reviewers">
<td><abbr title="These people reviewed this material for accuracy and correctness">Reviewers</abbr></td>
<td>
{% for id in include.contributors.reviewing %}{{ include.sep }}{% if include.badge %}{% include _includes/contributor-badge.html id=id small=true %}{% else %}{{ contributors[id].name | default: id }}{% endif %}{%- endfor -%}
</td>
</tr>
{% endif %}

{% if include.contributors.ux %}
<tr>
<td><abbr title="These people contributed UX or Design improvements to this tutorial or the GTN as a whole">UX/Designer(s)</abbr></td>
Expand Down
2 changes: 1 addition & 1 deletion _includes/contributors-line.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div markdown="0">
{% if include.page.contributors %}
<div class="contributors-line">
{% unless include.authorsonly %}{{ locale['authors'] | default: "Authors" }}: {% endunless %}{% include _includes/contributor-list.html contributors=include.page.contributors badge=true newcontributors=include.newcontributors %}
{% include _includes/contributor-list.html contributors=include.page.contributors badge=true newcontributors=include.newcontributors %}
</div>
{% elsif include.page.contributions %}
<div class="contributors-line">
Expand Down
2 changes: 1 addition & 1 deletion _layouts/workflow.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h1 data-toc-skip>{{ workflow.title }}</h1>
{% endif %}

{% if workflow.workflowhub_id %}
<a style="margin-bottom: 0.2rem" href="https://workflowhub.eu/workflows/{{ workflow.workflowhub_id }}" class="btn btn-secondary"><img src="{% link assets/images/workflowhub-icon.svg %}" style="height: 32px" alt="Workflowhub cloud with gears logo"/> View on WorkflowHub</a>
<a style="margin-bottom: 0.2rem" href="https://dev.workflowhub.eu/workflows/{{ workflow.workflowhub_id }}" class="btn btn-secondary"><img src="{% link assets/images/workflowhub-icon.svg %}" style="height: 32px" alt="Workflowhub cloud with gears logo"/> View on (Dev) WorkflowHub</a>
{% endif %}

</div>
Expand Down
68 changes: 68 additions & 0 deletions _plugins/author-page.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require './_plugins/gtn/mod'
require './_plugins/gtn'

module Jekyll
Expand Down Expand Up @@ -168,3 +169,70 @@ def generate(site)
end
end
end

Jekyll::Hooks.register :site, :post_read do |site|
if Jekyll.env == 'production'
Jekyll.logger.info "[GTN/Reviewers] Ingesting GitHub reviewer metadata"
start_time = Time.now
# Maps a lowercase version of their name to the potential mixed-case version
contribs_lower = site.data['contributors'].map{|k, v| [k.downcase, k]}.to_h

# Annotate the from github metadata
gh_reviewers_by_path = Hash.new { |hash, key| hash[key] = [] }
# Hash of PRs by path
site.data['github'].each do |num, pr|
# Within a PR we have some reviews, let's get that set organised:
reviewers = pr['reviews'].map do |review|
# Just "people"
contribs_lower.fetch(review['author']['login'].downcase, review['author']['login'])
end.uniq.reject{|x| x == 'github-actions'}

pr['files'].select{|p| p['path'] =~ /.(md|html)$/}.each do |file|
real_path = Gtn::PublicationTimes.chase_rename(file['path'])
gh_reviewers_by_path[real_path] += reviewers
gh_reviewers_by_path[real_path].uniq!
end
end

# For all of our pages, if the path is mentioned above, then, tag it.
site.pages.select{|t| gh_reviewers_by_path.key?(t.path)}.each do |t|
if t['layout'] == 'tutorial_hands_on' or !%w[base_slides introduction_slides tutorial_slides].index(t['layout']).nil?
if t.data.key?('contributors')
# Automatically 'upgrade' to new structure
t.data['contributions'] = {
'authorship' => t.data['contributors'],
'reviewing' => gh_reviewers_by_path[t.path]
}
t.data.delete('contributors')
elsif t.data.key?('contributions')
if t.data['contributions'].key?('reviewing')
t.data['contributions']['reviewing'] += gh_reviewers_by_path[t.path]
else
t.data['contributions']['reviewing'] = gh_reviewers_by_path[t.path]
end
t.data['contributions']['reviewing'].uniq!
end
end
end

site.posts.docs.select{|t| gh_reviewers_by_path.key?(t.path)}.each do |t|
if t['layout'] == 'news'
if t.data.key?('contributors')
t.data['contributions'] = {
'authorship' => t.data['contributors'],
'reviewing' => gh_reviewers_by_path[t.path]
}
t.data.delete('contributors')
elsif t.data.key?('contributions')
if t.data['contributions'].key?('reviewing')
t.data['contributions']['reviewing'] += gh_reviewers_by_path[t.path]
else
t.data['contributions']['reviewing'] = gh_reviewers_by_path[t.path]
end
t.data['contributions']['reviewing'].uniq!
end
end
end
Jekyll.logger.info "[GTN/Reviewers] Complete in #{Time.now - start_time} seconds"
end
end
7 changes: 6 additions & 1 deletion _plugins/gtn/contributors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
module Gtn
# Parse the git repo to get some facts
module Contributors
@HAS_WARNED_ON = []

##
# Returns contributors, regardless of whether they are 'contributor' or 'contributions' style
# Params:
Expand Down Expand Up @@ -150,7 +152,10 @@ def self.fetch(site, c, warn: false)
return ['grant', site.data['grants'][c]]
else
if ! warn
Jekyll.logger.warn "Contributor #{c} not found"
if ! @HAS_WARNED_ON.include?(c)
Jekyll.logger.warn "Contributor #{c} not found"
@HAS_WARNED_ON.push(c)
end
end
end

Expand Down
17 changes: 11 additions & 6 deletions _plugins/gtn/mod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ def self.obtain_time(f_unk)
# This is faster than talking to the file system.
module PublicationTimes
@@TIME_CACHE = nil
@@RENAMES = nil

def self.chase_rename(renames, path, depth: 0)
if renames.key? path
def self.chase_rename(path, depth: 0)
if @@RENAMES.nil?
self.init_cache
end

if @@RENAMES.key? path
# TODO(hexylena)
# This happens because it's the wrong datastructure, if there's a loop
# in there, it'll just cycle through it endlessly.
Expand All @@ -128,7 +133,7 @@ def self.chase_rename(renames, path, depth: 0)
Jekyll.logger.error "[GTN/Time/Pub] Too many renames for #{path}"
path
else
chase_rename(renames, renames[path], depth: depth + 1)
chase_rename(@@RENAMES[path], depth: depth + 1)
end
else
path
Expand All @@ -139,7 +144,7 @@ def self.init_cache
return unless @@TIME_CACHE.nil?

@@TIME_CACHE = {}
renames = {}
@@RENAMES = {}

Jekyll.logger.info '[GTN/Time/Pub] Filling Publication Time Cache'
cached_command
Expand All @@ -151,11 +156,11 @@ def self.init_cache
modification_type, path = f.split("\t")
if modification_type == 'A'
# Chase the renames.
final_filename = chase_rename(renames, path)
final_filename = chase_rename(path)
@@TIME_CACHE[final_filename] = Time.at(date.to_i)
elsif modification_type[0] == 'R'
_, moved_from, moved_to = f.split("\t")
renames[moved_from] = moved_to # Point from the 'older' version to the newer.
@@RENAMES[moved_from] = moved_to # Point from the 'older' version to the newer.
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,17 @@ nav[data-toggle='toc'] {
}
}

.reviewers {
.contributor-badge {
margin: 0;
padding: 0;
img {
margin: 0;
padding: 0;
}
}
}

}

.contributor-badge {
Expand Down
7 changes: 7 additions & 0 deletions bin/schema-event-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ mapping:
- CONTRIBUTORS
- ORGANISATIONS
- GRANTS
reviewing:
type: seq
description: This person reviewed this material for accuracy and correctness
sequence:
- type: str
enum:
- CONTRIBUTORS
funding:
type: seq
description: These entities provided funding support for the development of this resource
Expand Down
7 changes: 7 additions & 0 deletions bin/schema-event.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ mapping:
- CONTRIBUTORS
- ORGANISATIONS
- GRANTS
reviewing:
type: seq
description: This person reviewed this material for accuracy and correctness
sequence:
- type: str
enum:
- CONTRIBUTORS
funding:
type: seq
description: These entities provided funding support for the development of this resource
Expand Down
7 changes: 7 additions & 0 deletions bin/schema-news.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ mapping:
- CONTRIBUTORS
- ORGANISATIONS
- GRANTS
reviewing:
type: seq
description: This person reviewed this material for accuracy and correctness
sequence:
- type: str
enum:
- CONTRIBUTORS
funding:
type: seq
description: These entities provided funding support for the development of this resource
Expand Down
7 changes: 7 additions & 0 deletions bin/schema-slides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ mapping:
- CONTRIBUTORS
- ORGANISATIONS
- GRANTS
reviewing:
type: seq
description: This person reviewed this material for accuracy and correctness
sequence:
- type: str
enum:
- CONTRIBUTORS
funding:
type: seq
description: These entities provided funding support for the development of this resource
Expand Down
7 changes: 7 additions & 0 deletions bin/schema-tutorial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ mapping:
- CONTRIBUTORS
- ORGANISATIONS
- GRANTS
reviewing:
type: seq
description: This person reviewed this material for accuracy and correctness
sequence:
- type: str
enum:
- CONTRIBUTORS
funding:
type: seq
description: These entities provided funding support for the development of this resource
Expand Down
Loading

0 comments on commit 0362bc0

Please sign in to comment.