Skip to content

Commit 70402f2

Browse files
Merge pull request #308 from codewithdark-git/main
🎉 Launch of the One Billionth GitHub
2 parents f3f2f26 + 5f6c8c6 commit 70402f2

15 files changed

+630
-1
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Your GitHub Personal Access Token
2+
# Create one at https://github.com/settings/tokens
3+
# Required scopes: repo, read:org
4+
GITHUB_TOKEN=your_token_here
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import os
2+
import re
3+
from github import Github
4+
import markdown
5+
from datetime import datetime
6+
7+
def validate_message(content):
8+
# Check for basic markdown formatting
9+
if not content.strip().startswith('-'):
10+
return False
11+
12+
# Check for proper attribution format
13+
if not re.search(r'@[\w-]+', content):
14+
return False
15+
16+
return True
17+
18+
def validate_story(content):
19+
# Check for minimum length
20+
if len(content.strip()) < 50:
21+
return False
22+
23+
# Check for basic markdown formatting
24+
if not re.search(r'#{1,6}\s+.*', content):
25+
return False
26+
27+
# Check for author attribution
28+
if not re.search(r'@[\w-]+', content):
29+
return False
30+
31+
return True
32+
33+
def process_messages():
34+
with open('MESSAGES.md', 'r', encoding='utf-8') as f:
35+
content = f.read()
36+
37+
# Ensure proper structure
38+
if '# Community Messages for the One Billionth Repo' not in content:
39+
content = '# Community Messages for the One Billionth Repo\n\n' + content
40+
41+
if 'Add your message below!' not in content:
42+
content = content.replace('# Community Messages for the One Billionth Repo\n',
43+
'# Community Messages for the One Billionth Repo\n\n'
44+
'Add your message below! \n'
45+
'_You can add a PR or comment with your congratulations, jokes, or hopes for the future._\n\n---\n\n')
46+
47+
# Sort messages
48+
messages = content.split('---\n\n')[1].strip().split('\n')
49+
messages = [m for m in messages if m.strip() and validate_message(m)]
50+
messages.sort()
51+
52+
# Rebuild file
53+
header = content.split('---\n\n')[0] + '---\n\n'
54+
return header + '\n'.join(messages)
55+
56+
def process_stories():
57+
try:
58+
with open('STORIES.md', 'r', encoding='utf-8') as f:
59+
content = f.read()
60+
except FileNotFoundError:
61+
content = '''# GitHub Stories
62+
63+
Share your GitHub journey and experiences here! Add your story with a pull request.
64+
65+
## Guidelines
66+
- Add a meaningful title for your story
67+
- Include your GitHub handle
68+
- Share something unique about your experience
69+
- Keep it friendly and constructive
70+
71+
---
72+
73+
'''
74+
75+
# Split into sections and validate
76+
sections = re.split(r'(?=##\s+)', content)
77+
header = sections[0]
78+
stories = sections[1:]
79+
80+
# Sort stories by title
81+
stories = [s for s in stories if validate_story(s)]
82+
stories.sort(key=lambda x: re.search(r'##\s+(.*)', x).group(1).lower())
83+
84+
return header + '\n'.join(stories)
85+
86+
def main():
87+
token = os.getenv('GITHUB_TOKEN')
88+
pr_number = int(os.getenv('PR_NUMBER'))
89+
90+
g = Github(token)
91+
repo = g.get_repo(os.getenv('GITHUB_REPOSITORY'))
92+
pr = repo.get_pull(pr_number)
93+
94+
files_changed = [f.filename for f in pr.get_files()]
95+
96+
if 'MESSAGES.md' in files_changed:
97+
processed_content = process_messages()
98+
with open('MESSAGES.md', 'w', encoding='utf-8') as f:
99+
f.write(processed_content)
100+
101+
if 'STORIES.md' in files_changed:
102+
processed_content = process_stories()
103+
with open('STORIES.md', 'w', encoding='utf-8') as f:
104+
f.write(processed_content)
105+
106+
if __name__ == '__main__':
107+
main()

.github/scripts/updates_stats.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
from github import Github
2+
import os
3+
import datetime
4+
import json
5+
from pathlib import Path
6+
from src.github_api import GitHubAPI
7+
8+
def update_readme_stats(stats, content):
9+
stats_section = f"""## 📊 Repository Stats
10+
- ⭐ Stars: {stats['stars']}
11+
- 🍴 Forks: {stats['forks']}
12+
- 📬 Open Issues: {stats['issues']}
13+
- 👀 Watchers: {stats['watchers']}
14+
- 📅 Last Updated: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M UTC')}
15+
"""
16+
return content.replace("## 📊 Repository Stats\n", stats_section)
17+
18+
def update_trending_section(trending_repos, content):
19+
trending_section = "### 🔥 Trending Repositories\n"
20+
for repo in trending_repos[:5]:
21+
trending_section += f"- [{repo['full_name']}]({repo['html_url']}): {repo['description']}{repo['stargazers_count']}\n"
22+
23+
return content.replace("### 🔥 Trending Repositories\n", trending_section)
24+
25+
def update_language_section(language_stats, content):
26+
language_section = "### 🎨 By Programming Language\n"
27+
for lang, stats in sorted(language_stats.items(), key=lambda x: x[1]['stars'], reverse=True)[:5]:
28+
language_section += f"- {lang}: {stats['count']} repositories, {stats['stars']} total stars\n"
29+
30+
return content.replace("### 🎨 By Programming Language\n", language_section)
31+
32+
def main():
33+
# Initialize API clients
34+
github_token = os.environ['GITHUB_TOKEN']
35+
g = Github(github_token)
36+
api = GitHubAPI(github_token)
37+
38+
# Get repository stats
39+
repo = g.get_repo("AasishPokhrel/shit")
40+
stats = {
41+
'stars': repo.stargazers_count,
42+
'forks': repo.forks_count,
43+
'issues': repo.open_issues_count,
44+
'watchers': repo.watchers_count
45+
}
46+
47+
# Get trending repositories
48+
trending_repos = api.get_trending_repos(since="weekly")
49+
50+
# Get language statistics
51+
language_stats = api.get_language_stats()
52+
53+
# Get topic statistics
54+
topics = ["ai", "web-development", "mobile", "devops", "security"]
55+
topic_stats = api.get_topic_stats(topics)
56+
57+
# Update README
58+
with open('README.md', 'r', encoding='utf-8') as file:
59+
content = file.read()
60+
61+
content = update_readme_stats(stats, content)
62+
content = update_trending_section(trending_repos.get('items', []), content)
63+
content = update_language_section(language_stats, content)
64+
65+
with open('README.md', 'w', encoding='utf-8') as file:
66+
file.write(content)
67+
68+
# Save detailed stats for historical tracking
69+
stats_dir = Path('.github/stats')
70+
stats_dir.mkdir(exist_ok=True)
71+
72+
timestamp = datetime.datetime.now().strftime('%Y%m%d_%H%M')
73+
stats_file = stats_dir / f'stats_{timestamp}.json'
74+
75+
full_stats = {
76+
'repository': stats,
77+
'trending': trending_repos,
78+
'languages': language_stats,
79+
'topics': topic_stats,
80+
'timestamp': timestamp
81+
}
82+
83+
with open(stats_file, 'w', encoding='utf-8') as f:
84+
json.dump(full_stats, f, indent=2)
85+
86+
if __name__ == "__main__":
87+
main()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Handle Community Content
2+
3+
on:
4+
pull_request:
5+
types: [opened, labeled, synchronize]
6+
paths:
7+
- 'MESSAGES.md'
8+
- 'STORIES.md'
9+
10+
jobs:
11+
process-content:
12+
runs-on: ubuntu-latest
13+
if: |
14+
contains(github.event.pull_request.labels.*.name, 'message') ||
15+
contains(github.event.pull_request.labels.*.name, 'story')
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.event.pull_request.head.ref }}
21+
fetch-depth: 0
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.x'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install PyGithub>=2.1.1 markdown>=3.4.3
32+
33+
- name: Validate and Process Content
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
36+
PR_NUMBER: ${{ github.event.pull_request.number }}
37+
run: python .github/scripts/process_community_content.py
38+
39+
- name: Auto-merge if checks pass
40+
if: success()
41+
run: |
42+
gh pr merge ${{ github.event.pull_request.number }} --auto --merge
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

.github/workflows/update-stats.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update Repository Stats
2+
3+
on:
4+
schedule:
5+
- cron: '0 */6 * * *' # Runs every 6 hours
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-stats:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install requests PyGithub pandas plotly
22+
23+
- name: Update Stats
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
26+
run: |
27+
python .github/scripts/updates_stats.py
28+
python src/visualizations.py
29+
30+
- name: Commit changes
31+
run: |
32+
git config --local user.email "[email protected]"
33+
git config --local user.name "GitHub Action"
34+
git add README.md
35+
git commit -m "Update repository statistics" || exit 0
36+
git push
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Update Trending Repositories
2+
3+
on:
4+
schedule:
5+
- cron: '0 */6 * * *' # Run every 6 hours
6+
workflow_dispatch: # Allow manual trigger
7+
8+
9+
jobs:
10+
update-trending:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
26+
- name: Update trending repositories
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
29+
run: |
30+
python src/update_trending.py
31+
32+
- name: Commit and push changes
33+
run: |
34+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
35+
git config --local user.name "github-actions[bot]"
36+
git add PUBLIC_REPOS.md
37+
git commit -m "🔄 Update trending repositories data" || exit 0
38+
git push

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

MESSAGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Community Messages for the One Billionth Repo
2+
3+
Add your message below!
4+
_You can add a PR or comment with your congratulations, jokes, or hopes for the future._
5+
6+
---
7+
8+
- “Congrats, GitHub! You’ve come a long way.” — @codewithdark-git
9+
- “Here’s to another billion!” — @octocat

PUBLIC_REPOS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 🚀 Public GitHub Repositories by Category
2+
3+
## Trending
4+
- [OpenListTeam/OpenList](https://github.com/OpenListTeam/OpenList): A new AList Fork to Anti Trust Crisis ⭐3309
5+
- [AasishPokhrel/shit](https://github.com/AasishPokhrel/shit): No description provided ⭐2347
6+
- [BeehiveInnovations/zen-mcp-server](https://github.com/BeehiveInnovations/zen-mcp-server): The power of Claude Code + [Gemini Pro / Flash / O3 / O3-Mini / OpenRouter / Ollama / Custom Model / All Of The Above] working as one. ⭐1376
7+
- [rdev/liquid-glass-react](https://github.com/rdev/liquid-glass-react): Apple's Liquid Glass effect for React ⭐1334
8+
- [guandeh17/Self-Forcing](https://github.com/guandeh17/Self-Forcing): No description provided ⭐1009
9+
- [GeeeekExplorer/nano-vllm](https://github.com/GeeeekExplorer/nano-vllm): Nano vLLM ⭐914
10+
- [supermemoryai/supermemory-mcp](https://github.com/supermemoryai/supermemory-mcp): Your memories are in ChatGPT... But nowhere else. Universal Memory MCP makes your memories available to every single LLM. No logins or paywall. One command to set it up. ⭐912
11+
- [wgsxm/PartCrafter](https://github.com/wgsxm/PartCrafter): PartCrafter: Structured 3D Mesh Generation via Compositional Latent Diffusion Transformers ⭐742
12+
- [multigres/multigres](https://github.com/multigres/multigres): Vitess for Postgres ⭐545
13+
- [lucasromerodb/liquid-glass-effect-macos](https://github.com/lucasromerodb/liquid-glass-effect-macos): Demo here ⭐506
14+
15+
## Most Starred
16+
- [torvalds/linux](https://github.com/torvalds/linux): Linux kernel source tree ⭐100000
17+
## Python
18+
- [psf/requests](https://github.com/psf/requests): A simple, yet elegant, HTTP library. ⭐50000
19+
## JavaScript
20+
- [facebook/react](https://github.com/facebook/react): A declarative, efficient, and flexible JavaScript library for building user interfaces. ⭐200000

0 commit comments

Comments
 (0)