Skip to content

Commit e69dab3

Browse files
lochhhniksirbi
andauthored
Add people section and support for automatic contributors list update (#554)
* Configure all-contributors Revert to minimal all-contributors config * Use contributors-readme-action * Use default 6 columns per row * Make logos the same size as the dark version * Add funders and leadership sections * Schedule job to run monthly or on manual trigger * Update workflow names * Use custom commit message * Set logos to have consistent height 150px * Set 5 columns per row in contributors table * Use custom contributors CSS class for table cells * Add contributors manually * Set contributors table width to 100% * Remove `all-contributors`-relevant changes * Allow for non-github users to be added to contributors table * Add docs on updating contributors list * Rephrase workflow description * Add collaborations * Apply suggestions from code review Co-authored-by: Niko Sirmpilatze <niko.sirbiladze@gmail.com> * Move People to section top * Separate manually added gh users * Simplify syntax for manually adding non-gh contributors * Simplify instructions for manually adding non-gh contributors * Correct wording from "collaborations" to "collaborators" * Remove cols_per_row config * Update instructions for adding gh contributors --------- Co-authored-by: Niko Sirmpilatze <niko.sirbiladze@gmail.com>
1 parent fe581a7 commit e69dab3

16 files changed

+187
-17
lines changed

.github/workflows/test_and_deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Tests
22

33
on:
44
push:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Contributors
2+
3+
# Update the contributors list in the documentation monthly
4+
# on the default branch main using the Contributors-Readme-Action GitHub Action.
5+
# As the branch is protected, the action will create a pull request.
6+
# Alternatively, the action can be triggered manually using the workflow_dispatch event.
7+
on:
8+
schedule:
9+
- cron: '0 0 1 * *' # Runs at midnight on the first day of every month
10+
workflow_dispatch:
11+
12+
jobs:
13+
update_contributors_list:
14+
name: Update Contributors List
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
- name: Contribute List
21+
uses: akhilmhdh/contributors-readme-action@v2.3.10
22+
with:
23+
readme_path: docs/source/community/people.md
24+
commit_message: 'Update contributors list'
25+
pr_title_on_protected: 'Contributors-Readme-Action: Update contributors list'
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,38 @@ For example, to reference the {meth}`xarray.Dataset.update` method, use:
298298
:::
299299
::::
300300

301+
### Updating the contributors list
302+
The [contributors list](target-contributors) is automatically updated on the first day of each month by a GitHub actions workflow (`.github/workflows/update_contributors_list.yml`).
303+
It uses the [Contributors-Readme-Action](https://github.com/marketplace/actions/contribute-list) to generate the list of contributors based on the commits to the repository.
304+
305+
It is also possible to manually add other contributors who have not contributed code to the repository, but have contributed in other ways (e.g. by providing sample data, or by actively participating in discussions).
306+
The way to add them differs depending on whether they are GitHub users or not.
307+
308+
::::{tab-set}
309+
:::{tab-item} GitHub users
310+
To add a contributor who has a GitHub account, locate the section marked with `<!-- MANUAL: OTHER GITHUB CONTRIBUTORS -->` in `docs/source/community/people.md`.
311+
312+
Next, add their GitHub username (e.g. `newcontributor`) to the `<!-- readme: -start -->` and `<!-- readme: -end -->` lines as follows:
313+
```html
314+
<!-- readme: githubUser1,githubUser2,newcontributor -start -->
315+
existing content...
316+
<!-- readme: githubUser1,githubUser2,newcontributor -end -->
317+
```
318+
319+
The aforementioned GitHub actions workflow will then automatically update the contributors list with `newcontributor`'s GitHub profile picture, name, and link to their GitHub profile.
320+
:::
321+
322+
:::{tab-item} Non-GitHub users
323+
To add a contributor who does not have a GitHub account, locate the section marked with `<!-- MANUAL: OTHER NON-GITHUB CONTRIBUTORS -->` in `docs/source/community/people.md`.
324+
325+
Next, add a row containing the contributor's image, name, and link to their website to the existing `list-table` as follows:
326+
```markdown
327+
* - existing content...
328+
* - [![newcontributor](https://newcontributor.image.jpg) <br /> <sub><b>New Contributor</b></sub>](https://newcontributor.website.com)
329+
```
330+
:::
331+
::::
332+
301333
### Building the documentation locally
302334
We recommend that you build and view the documentation website locally, before you push your proposed changes.
303335

docs/source/_static/css/custom.css

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
11
html[data-theme=dark] {
2-
--pst-color-primary: #04B46D;
3-
--pst-color-link: var(--pst-color-primary);
4-
}
2+
--pst-color-primary: #04B46D;
3+
--pst-color-link: var(--pst-color-primary);
4+
}
55

66
html[data-theme=light] {
77
--pst-color-primary: #03A062;
88
--pst-color-link: var(--pst-color-primary);
99
}
1010

1111
body .bd-article-container {
12-
max-width: 100em !important;
12+
max-width: 100em !important;
1313
}
1414

1515
.col {
16-
flex: 0 0 50%;
17-
max-width: 50%;
16+
flex: 0 0 50%;
17+
max-width: 50%;
1818
}
1919

2020
.img-sponsor {
21-
height: 50px;
22-
padding-top: 5px;
23-
padding-right: 5px;
24-
padding-bottom: 5px;
25-
padding-left: 5px;
21+
height: 50px;
22+
padding: 5px;
23+
}
24+
25+
.img-sponsor-large {
26+
height: 10vh;
27+
padding: 5px;
2628
}
2729

2830
.things-in-a-row {
29-
display: flex;
30-
flex-wrap: wrap;
31-
justify-content: space-between;
31+
display: flex;
32+
flex-wrap: wrap;
33+
justify-content: space-between;
34+
}
35+
36+
.contributors-table table {
37+
width: 100%;
38+
}
39+
40+
.contributors-table td{
41+
padding: 2px;
42+
min-width: 90px;
43+
vertical-align: top;
44+
text-align: center;
3245
}
3346

3447
/* Disable decoration for all but movement backrefs */
3548
a[class^="sphx-glr-backref-module-"],
3649
a[class^="sphx-glr-backref-type-"] {
3750
text-decoration: none;
3851
}
52+
3953
a[class^="sphx-glr-backref-module-movement"] {
4054
text-decoration: underline;
4155
}
16.2 KB
Loading
11.1 KB
Loading
-8.15 KB
Loading
7.57 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
const contributorsDiv = document.querySelector('.contributors-table');
3+
const contributorsTable = document.createElement('table');
4+
const tbody = document.createElement('tbody');
5+
// Get all <td> elements
6+
const allContributors = Array.from(contributorsDiv.querySelectorAll('td'));
7+
const rows = [];
8+
while (allContributors.length) {
9+
const row = allContributors.splice(0, 5); // 5 columns per row
10+
rows.push(row);
11+
}
12+
rows.forEach(row => {
13+
const tr = document.createElement('tr');
14+
row.forEach(td => tr.appendChild(td));
15+
tbody.appendChild(tr);
16+
});
17+
// Replace existing content with the new table
18+
contributorsDiv.innerHTML = '';
19+
contributorsTable.appendChild(tbody);
20+
contributorsDiv.appendChild(contributorsTable);
21+
});
-140 KB
Loading

0 commit comments

Comments
 (0)