Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts and data for single cell paper graphs #5511

Merged
merged 21 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/cron-commit-cache.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "[Cron] Update Commit Cache"
name: "[Cron] Update Commit Cache, PR Data"
on:
workflow_dispatch:
schedule:
Expand Down Expand Up @@ -54,6 +54,11 @@ jobs:
run: |
bundle exec ruby bin/geocode.rb

- name: Update github metadata dataset
id: ghmeta
run: |
bundle exec ruby bin/collect-gh.rb

- name: Create Pull Request
# If it's not a Pull Request then commit any changes as a new PR.
uses: peter-evans/create-pull-request@v3
Expand Down
74 changes: 63 additions & 11 deletions _layouts/contributor_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ <h2>Contributions</h2>
<p class="text-muted">
The following list includes only slides and tutorials where the individual or organisation has been added to the contributor list. This may not include the sum total of their contributions to the training materials (e.g. GTN css or design, tutorial datasets, workflow development, etc.) unless described by a news post.

{% unless entity.github == false %}
<br><br>
{% unless entity.funder %}
<h3> GitHub Activity</h4>
<ul>
<li><a href="https://github.com/galaxyproject/training-material/pulls?q=is%3Apr+author%3A{{page.contributor}}">{% icon github %} Pull Requests</a> </li>
<li><a href="https://github.com/galaxyproject/training-material/commits?author={{page.contributor}}">{% icon github %} Commits</a></li>
<li><a href="https://github.com/galaxyproject/training-material/issues?q=+is%3Aissue+author%3A{{page.contributor}}">{% icon github %} Issues Reported</a></li>
</ul>
{% endunless %}
{% endunless %}
</p>
{% if page.editor_count > 0 %}
<h3>Editorial Roles</h3>
Expand Down Expand Up @@ -231,6 +220,69 @@ <h3>Events</h3>
</ul>
{% endif %}

{% unless entity.github == false %}
<br><br>
{% unless entity.funder %}
<h3> GitHub Activity</h4>
<a href="https://github.com/galaxyproject/training-material/issues?q=+is%3Aissue+author%3A{{page.contributor}}">{% icon github %} Issues Reported</a>

{% if page.gh_prs_count > 0 %}
<h4>{{ page.gh_prs_count }} Merged Pull Requests</h4>
<p>
See all of the
<a href="https://github.com/galaxyproject/training-material/pulls?q=is%3Apr+author%3A{{page.contributor}}">{% icon github %} Pull Requests</a> and
<a href="https://github.com/galaxyproject/training-material/commits?author={{page.contributor}}">{% icon github %} Commits</a> by {{ entity.name | default: page.contributor }}.
</p>
<ul>
{% for pr in page.gh_prs_recent %}
<li>
{% assign prdata = site.data['github'][pr] %}
{% if prdata.author.login == "github-actions" %}
{% icon github %}
{% else %}
<img src="https://github.com/{{ prdata.author.login }}.png?s=20" alt="{{ prdata.author.login }}" style="height: 1.2em; margin: 0px; border-radius: 25%;">
{% endif %}

<a href="{{ prdata.url }}">{{ prdata.title }}</a>

{% for label in prdata.labels %}
{% if forloop.index <= 5 %}
<div class="label label-default tutorial_tag" style="{{ label | colour_tag }}">{{ label }}</div>
{% endif %}
{% endfor %}
</li>
{% endfor %}
</ul>
{% endif %}

{% if page.gh_reviews_count > 0 %}
<h4>Reviewed {{ page.gh_reviews_count }} PRs</h4>
<p>We love our community reviewing each other's work!</p>
<ul>
{% for pr in page.gh_reviews_recent %}
<li>
{% assign prdata = site.data['github'][pr] %}

{% if prdata.author.login == "github-actions" %}
{% icon github %}
{% else %}
<img src="https://github.com/{{ prdata.author.login }}.png?s=20" alt="{{ prdata.author.login }}" style="height: 1.2em; margin: 0px; border-radius: 25%;">
{% endif %}
<a href="{{ prdata.url }}">{{ prdata.title }}</a>

{% for label in prdata.labels %}
{% if forloop.index <= 5 %}
<div class="label label-default tutorial_tag" style="{{ label | colour_tag }}">{{ label }}</div>
{% endif %}
{% endfor %}
</li>
{% endfor %}

</ul>
{% endif %}

{% endunless %}
{% endunless %}

{% if page.news_count > 0 %}
<h3>News</h3>
Expand Down
24 changes: 24 additions & 0 deletions _plugins/author-page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ def generate(site)
videos_by_author = Hash.new { |hash, key| hash[key] = [] }
has_philosophy = Hash.new { false }

prs_by_author = Hash.new { |hash, key| hash[key] = [] }
reviews_by_author = Hash.new { |hash, key| hash[key] = [] }

site.data['github'].each do |num, pr|
prs_by_author[pr['author']['login']] << [num, pr['mergedAt']]

pr['reviews'].each do |review|
reviews_by_author[review['author']['login']] << [num, review['submittedAt'], review['state']]
end
end

site.pages.each do |t|
# Tutorials
pusher(t, tutorials_by_author, false) if t['layout'] == 'tutorial_hands_on'
Expand Down Expand Up @@ -129,6 +140,19 @@ def generate(site)

page2.data['has_philosophy'] = has_philosophy[contributor]

countable_reviews = reviews_by_author[contributor]
.reject{|x| x[1].nil?} # Group by PRs.
.group_by{|x| x[0]}.map{|x, r| r.sort_by{|r1| r1[1]}.max}.sort_by{|w| w[1]}.reverse

page2.data['gh_prs_count'] = prs_by_author[contributor].count
page2.data['gh_reviews_count'] = countable_reviews.count

page2.data['gh_prs_recent'] = prs_by_author[contributor]
.reject{|x| x[1].nil?}.sort_by { |x| x[1] }.reverse.take(5)
.map{|x| x[0]}
page2.data['gh_reviews_recent'] = countable_reviews.take(5)
.map{|x| x[0]}

site.pages << page2
end
end
Expand Down
2 changes: 2 additions & 0 deletions _plugins/util.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'yaml'

def safe_load_yaml(file)
YAML.load_file(file)
rescue StandardError
Expand Down
Loading
Loading