Skip to content

Commit e595371

Browse files
authored
wip: test querying GH API to generate list of members
1 parent 544b29c commit e595371

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- name: Build
3535
run: |
3636
cd mkdocs/
37+
python scripts/generate_members_grid.py
3738
mkdocs build -d ../www/
3839
3940
- name: Deploy

docs/community/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ to efficiently evaluate the validity of new features (even to exercise a minuscu
3636
of the domain of inputs).
3737
The redundancy of expert eyes looking at our code has only helped make it better.
3838

39-
[Neurostars.org]: https://neurostars.org
39+
## Members
40+
4041

42+
[Neurostars.org]: https://neurostars.org

scripts/generate_members_grid.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
2+
# vi: set ft=python sts=4 ts=4 sw=4 et:
3+
#
4+
# Copyright 2021 The NiPreps Developers <[email protected]>
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# We support and encourage derived works from this project, please read
19+
# about our expectations at
20+
#
21+
# https://www.nipreps.org/community/licensing/
22+
#
23+
"""Query the GitHub API to retrieve the list of members."""
24+
25+
import os
26+
import requests
27+
28+
29+
def main(argv=None):
30+
gh_token = os.getenv("GITHUB_TOKEN", None)
31+
32+
if not gh_token:
33+
raise RuntimeError("No token")
34+
35+
response = requests.get(
36+
"https://api.github.com/orgs/nipreps/members?per_page=100",
37+
headers={
38+
"Accept": "application/vnd.github+json",
39+
"Authorization": f"Bearer {gh_token}",
40+
}
41+
)
42+
43+
if not response.ok:
44+
raise RuntimeError(f"Response failed ({response.code})")
45+
46+
members = [
47+
f'<img class=".avatar" src="{item["avatar_url"}" />'
48+
for item in response.json()
49+
]
50+
51+
print("\n".join(members))
52+
53+
54+
if __name__ == "__main__":
55+
main()

0 commit comments

Comments
 (0)