Skip to content
Open
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
62 changes: 62 additions & 0 deletions .github/scripts/build-contributor-wall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import json
import re
from pathlib import Path

README = Path("README.md")

# Load contributors from the files
contributors = json.loads(
Path("/tmp/contributors.json").read_text(encoding="utf-8")
)

cards = []

# It create one contributor card
for c in contributors:
cards.append(
f"""
<span align="center">
<a href="{c['html_url']}">
<img src="{c['avatar_url']}&s=64"
width="64"
height="64"
alt="{c['login']}" />
<br/>
<sub><b>{c['login']}</b></sub>
</a>
</span>
&nbsp;&nbsp;
"""
)

# Build contributor wall
wall = f"""
<div align="center">

### {len(contributors)} Contributors

<p align="center">
{"".join(cards)}
</p>

*Auto-updated daily ·
<a href="https://github.com/itsdakshjain/is-one-one/graphs/contributors">
View all →
</a>*

</div>
"""

# Read README
content = README.read_text(encoding="utf-8")

# Replace everything between the markers
content = re.sub(
r"<!-- CONTRIBUTOR-WALL-START -->.*?<!-- CONTRIBUTOR-WALL-END -->",
f"<!-- CONTRIBUTOR-WALL-START -->\n{wall}\n<!-- CONTRIBUTOR-WALL-END -->",
content,
flags=re.S,
)

# Write updated README
README.write_text(content, encoding="utf-8")
44 changes: 44 additions & 0 deletions .github/workflows/contributor-wall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Update Contributor Wall

on:
push:
branches:
- main

schedule:
- cron: "0 2 * * *"

workflow_dispatch:

concurrency:
group: contributor-wall
cancel-in-progress: false

jobs:
update-wall:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Fetch contributors
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api "repos/${{ github.repository }}/contributors" \
--paginate \
| jq -s 'add | map(select(.type != "Bot"))' \
> /tmp/contributors.json

- name: Build wall
run: python ./.github/scripts/build-contributor-wall.py

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update contributor wall [skip ci]"
file_pattern: README.md
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,29 @@ If you're reading this and thinking

## Contributors

A huge thanks to the legends who decided to waste their CPU cycles on this:
## 🏆 Contributors

<a href="https://github.com/Py-Contributors/is-one-one/graphs/contributors">
<img src="https://contrib.rocks/image?repo=Py-Contributors/is-one-one" />
</a>
Everyone who has helped prove that **1 is still 1**.

*Click on any contributor's avatar above to visit their GitHub profile. New contributors are automatically added here!*
This wall regenerates automatically whenever contributions are merged.

<!-- CONTRIBUTOR-WALL-START -->
<div align="center">

### Contributors

<p align="center">
<a href="https://github.com/itsdakshjain">
<img src="https://avatars.githubusercontent.com/itsdakshjain?s=64"
width="52"
height="52"
alt="itsdakshjain"
style="border-radius:50%;margin:4px"/>
</a>
</p>

</div>
<!-- CONTRIBUTOR-WALL-END -->


## The "Serious" Engineering Side
Expand Down
Loading