Skip to content

Commit

Permalink
Update teams
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman committed Feb 24, 2024
1 parent 83910b7 commit 14d67ff
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 94 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.DEFAULT_GOAL := doc-serve

GH_ORG = scientific-python
TEAMS_DIR = doc/static/teams
TEAMS_DIR = doc/content/about
TEAMS = theme-team
TEAMS_QUERY = python tools/team_query.py

Expand All @@ -11,7 +11,7 @@ $(TEAMS_DIR):

$(TEAMS_DIR)/%.md: $(TEAMS_DIR)
$(eval TEAM_NAME=$(shell python -c "import re; print(' '.join(x.capitalize() for x in re.split('-|_', '$*')))"))
$(TEAMS_QUERY) --org $(GH_ORG) --team "$*" > $(TEAMS_DIR)/$*.html
$(TEAMS_QUERY) --org $(GH_ORG) --team "$*" --dir $(TEAMS_DIR)

teams-clean:
for team in $(TEAMS); do \
Expand Down
2 changes: 1 addition & 1 deletion doc/content/about/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ The **Scientific Python Hugo Theme** is a theme for the
[Hugo](https://gohugo.io) static site generator built on the
[Fresh](https://github.com/StefMa/hugo-fresh) theme.

{{< include-html "static/teams/theme-team.html" >}}
{{< gallery pages="./theme-team" columns="2 4 4 5" >}}
5 changes: 5 additions & 0 deletions doc/content/about/theme-team/adam-porter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Adam Porter"
avatar: https://avatars.githubusercontent.com/u/601365?v=4
repository: https://github.com/alphapapa
---
5 changes: 5 additions & 0 deletions doc/content/about/theme-team/brian-hawthorne.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Brian Hawthorne"
avatar: https://avatars.githubusercontent.com/u/352264?u=1fd523aa28b0451454989400579d97a8c1bc1b9a&v=4
repository: https://github.com/brianhawthorne
---
Empty file.
5 changes: 5 additions & 0 deletions doc/content/about/theme-team/jarrod-millman.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Jarrod Millman"
avatar: https://avatars.githubusercontent.com/u/123428?v=4
repository: https://github.com/jarrodmillman
---
5 changes: 5 additions & 0 deletions doc/content/about/theme-team/pamphile-roy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Pamphile Roy"
avatar: https://avatars.githubusercontent.com/u/23188539?u=64445b52dbf3f75de8006ed4264fdd2afaed97a3&v=4
repository: https://github.com/tupui
---
5 changes: 5 additions & 0 deletions doc/content/about/theme-team/stefan-van-der-walt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: "Stefan van der Walt"
avatar: https://avatars.githubusercontent.com/u/45071?u=c779b5e06448fbc638bc987cdfe305c7f9a7175e&v=4
repository: https://github.com/stefanv
---
61 changes: 0 additions & 61 deletions doc/static/teams/theme-team.html

This file was deleted.

43 changes: 13 additions & 30 deletions tools/team_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ def api(query):
parser = argparse.ArgumentParser(description="Generate team gallery from GitHub")
parser.add_argument("--org", required=True, help="GitHub organization name")
parser.add_argument("--team", required=True, help="Team name in the organization")
parser.add_argument("--dir", required=True, help="Directory for team members")
args = parser.parse_args()

org = args.org
team = args.team
directory = os.path.join(args.dir, team)
os.makedirs(directory, exist_ok=True)

token = os.environ.get("GH_TOKEN", None)
if token is None:
Expand All @@ -61,38 +64,18 @@ def api(query):
members = resp["data"]["organization"]["team"]["members"]["nodes"]
team_name = resp["data"]["organization"]["team"]["name"]

team_template = string.Template(
"""\
<div class="team">
<h3 id="${team}" class="team-name">${team_name}</h3>
<div class="team-members">
${members}
</div>
</div>"""
)

member_template = string.Template(
"""\
<div class="team-member">
<a href="${url}" class="team-member-name">
<div class="team-member-photo">
<img
src="${avatarUrl}"
loading="lazy"
alt="Avatar of ${name}"
/>
</div>
${name}
</a>
</div>"""
"""---
title: "${name}"
avatar: ${avatarUrl}
repository: ${url}
---
"""
)

members_list = []
for m in members:
m["name"] = m["name"] or m["login"]
members_list.append(member_template.substitute(**m))

members_str = "".join(members_list)
team_str = team_template.substitute(members=members_str, team=team, team_name=team_name)

print(team_str)
filename = os.path.join(directory, f"{m['name'].lower().replace(' ', '-')}.md")
text = member_template.substitute(**m)
with open(filename, "w") as file:
file.write(text)

0 comments on commit 14d67ff

Please sign in to comment.