Skip to content

Commit 00f3ad0

Browse files
committed
feat: add github-organize-stars script for organizing starred repositories into GitHub Lists
1 parent b5c651d commit 00f3ad0

2 files changed

Lines changed: 416 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ This toolkit provides ready-to-use automation scripts for GitHub organization ad
3737

3838
### Prerequisites
3939

40-
- **bash** 4+
40+
- **bash** 4+
4141
- **[curl](https://curl.se)** - HTTP client for API requests
4242
- **[jq](https://stedolan.github.io/jq)** - Command-line JSON processor
4343
- **[git](https://git-scm.com)** - For repository operations (required by some scripts)
44+
- **[gh](https://cli.github.com)** - GitHub CLI (required by `github-organize-stars`)
4445
- **GitHub Personal Access Token** with appropriate scopes
4546

4647
### Installation
@@ -261,6 +262,50 @@ Total seats purchased: 200
261262
> [!IMPORTANT]
262263
> This script requires an enterprise-level token with `read:enterprise` scope. Organization tokens will not work.
263264
265+
---
266+
267+
### Organize Starred Repositories
268+
269+
**Script:** `github-organize-stars/github-organize-stars.sh`
270+
271+
Fetches all your starred repositories and organizes them into GitHub Lists using customizable categorization rules.
272+
273+
**Prerequisites:**
274+
- **[gh](https://cli.github.com)** - GitHub CLI (authenticated via `gh auth login`)
275+
- **[jq](https://stedolan.github.io/jq)** - Command-line JSON processor
276+
277+
**Usage:**
278+
```bash
279+
cd github-organize-stars
280+
./github-organize-stars.sh # Interactive (shows plan, asks to confirm)
281+
./github-organize-stars.sh --dry-run # Preview only, no changes made
282+
./github-organize-stars.sh -y # Skip confirmation prompt
283+
./github-organize-stars.sh --show-repos # Also list repo names in each category
284+
./github-organize-stars.sh --no-cache # Force re-fetch stars from GitHub
285+
```
286+
287+
**What it does:**
288+
- Fetches all starred repositories via the GraphQL API (paginated)
289+
- Categorizes each repo by primary language, GitHub topics, and repo name keywords
290+
- Creates new GitHub Lists and adds repos in batches of 25
291+
- Caches fetched stars locally at `~/.cache/gh-star-organizer/stars.json` to speed up re-runs
292+
- Shows a categorization plan and prompts for confirmation before making changes
293+
294+
**Customizing categories:**
295+
296+
Edit the `RULES` array in the script. Each rule is a `|`-delimited string:
297+
```
298+
"List Name|LANGUAGES|TOPICS|NAME_KEYWORDS"
299+
```
300+
- `LANGUAGES` — comma-separated primary language names (case-insensitive)
301+
- `TOPICS` — comma-separated GitHub topic slugs
302+
- `NAME_KEYWORDS` — comma-separated substrings matched against the repo name
303+
304+
The **first matching rule wins**, so order matters. Place more specific rules (e.g., AI) before general ones (e.g., Security).
305+
306+
> [!NOTE]
307+
> This script uses the `gh` CLI for all API calls (GraphQL) rather than `curl`. Ensure you are authenticated via `gh auth login` before running.
308+
264309
## Best Practices
265310

266311
**Test on a test organization first**

0 commit comments

Comments
 (0)