Skip to content

Commit a04ec15

Browse files
authored
Merge pull request #44 from ishandutta2007/copilot/check-for-issues
Fix CI, add issue templates, wire up CLI, add auto-sort workflow
2 parents 2adc677 + 711893d commit a04ec15

7 files changed

Lines changed: 177 additions & 13 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Add new repo
3+
about: Suggest a new AI/ML repository to add to the list
4+
title: 'Add repo: '
5+
labels: 'new repo'
6+
assignees: ''
7+
8+
---
9+
10+
**Repository URL**
11+
https://github.com/owner/repo
12+
13+
**Description**
14+
A brief description of the repository and why it should be included.
15+
16+
**Core Technology**
17+
e.g., Python, Rust, TypeScript, C++
18+
19+
**Category**
20+
e.g., LLM, Computer Vision, Audio, Agents, RAG, Deep Learning, MLOps
21+
22+
**Current Star Count**
23+
Approximate number of GitHub stars.
24+
25+
**Additional context**
26+
Any other relevant information about the project.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Auto-sort table
2+
3+
on:
4+
schedule:
5+
# Run every Sunday at 00:00 UTC
6+
- cron: '0 0 * * 0'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
sort:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install .
29+
30+
- name: Sort table by star count
31+
env:
32+
VITE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
run: python sort_table.py
34+
35+
- name: Fix serial numbers
36+
run: python fix_serials.py
37+
38+
- name: Check for changes
39+
id: diff
40+
run: |
41+
git diff --quiet README.md && echo "changed=false" >> "$GITHUB_OUTPUT" || echo "changed=true" >> "$GITHUB_OUTPUT"
42+
43+
- name: Create Pull Request
44+
if: steps.diff.outputs.changed == 'true'
45+
uses: peter-evans/create-pull-request@v7
46+
with:
47+
commit-message: 'chore: auto-sort table by star count'
48+
title: 'chore: auto-sort table by star count'
49+
body: |
50+
Automated weekly re-sort of the README table by current GitHub star counts.
51+
52+
Generated by the `auto-sort.yml` workflow.
53+
branch: auto-sort-table
54+
delete-branch: true

β€Ž.github/workflows/python-package.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.9", "3.10", "3.11"]
19+
python-version: ["3.11", "3.12", "3.13"]
2020

2121
steps:
2222
- uses: actions/checkout@v4
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
python -m pip install --upgrade pip
3030
python -m pip install flake8 pytest
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
python -m pip install .
3232
- name: Lint with flake8
3333
run: |
3434
# stop the build if there are Python syntax errors or undefined names

β€Žmain.pyβ€Ž

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,70 @@
1+
import argparse
2+
import sys
3+
14
from sort_table import sort_table
2-
from check_table import check_table
5+
from check_table import check_table_consistency as check_table_links
36
from check_repo_link_vs_user_link_inconsistencies import check_table_consistency
7+
from fix_serials import fix_serials
8+
9+
10+
def cmd_sort(args):
11+
"""Sort the README table by GitHub star count."""
12+
sort_table(args.file)
13+
14+
15+
def cmd_check(args):
16+
"""Run consistency checks on the README table."""
17+
file_path = args.file
18+
check_table_links(file_path)
19+
check_table_consistency(file_path)
20+
21+
22+
def cmd_fix_serials(args):
23+
"""Re-number table rows sequentially starting from 1."""
24+
fix_serials(args.file)
25+
print(f"Serial numbers fixed in {args.file}")
26+
27+
28+
def cmd_all(args):
29+
"""Run the full pipeline: sort β†’ check β†’ fix serials."""
30+
cmd_sort(args)
31+
cmd_fix_serials(args)
32+
cmd_check(args)
33+
434

535

636
def main():
7-
print("Hello from top-ai-repos!")
37+
parser = argparse.ArgumentParser(
38+
prog="top-ai-repos",
39+
description="Maintain the Top-AI-repos curated list.",
40+
)
41+
parser.add_argument(
42+
"-f", "--file",
43+
default="README.md",
44+
help="Path to the README file (default: README.md)",
45+
)
46+
47+
subparsers = parser.add_subparsers(dest="command")
48+
49+
subparsers.add_parser("sort", help="Sort table by star count")
50+
subparsers.add_parser("check", help="Run consistency checks")
51+
subparsers.add_parser("fix-serials", help="Fix row serial numbers")
52+
subparsers.add_parser("all", help="Run full pipeline: sort, fix-serials, check")
53+
54+
args = parser.parse_args()
55+
56+
commands = {
57+
"sort": cmd_sort,
58+
"check": cmd_check,
59+
"fix-serials": cmd_fix_serials,
60+
"all": cmd_all,
61+
}
62+
63+
if args.command is None:
64+
parser.print_help()
65+
sys.exit(0)
66+
67+
commands[args.command](args)
868

969

1070
if __name__ == "__main__":

β€Žsort_table.pyβ€Ž

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,20 @@ def sort_markdown_table(markdown_content):
186186
return new_markdown_content
187187

188188

189-
# Main execution
190-
file_path = r"./README.md"
189+
def sort_table(file_path=r"./README.md"):
190+
"""Main entry point: read, sort, and write back the README table."""
191+
with open(file_path, "r", encoding="utf-8") as f:
192+
content = f.read()
193+
194+
updated_content = sort_markdown_table(content)
191195

192-
with open(file_path, "r", encoding="utf-8") as f:
193-
content = f.read()
196+
with open(file_path, "w", encoding="utf-8") as f:
197+
f.write(updated_content)
194198

195-
updated_content = sort_markdown_table(content)
199+
save_cache(star_cache)
200+
print("Table sorting complete. Check README.md")
196201

197-
with open(file_path, "w", encoding="utf-8") as f:
198-
f.write(updated_content)
199202

200-
save_cache(star_cache)
201-
print("Table sorting complete. Check README.md")
203+
# Main execution
204+
if __name__ == "__main__":
205+
sort_table()
-222 Bytes
Binary file not shown.

0 commit comments

Comments
Β (0)