Skip to content
Draft
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
67 changes: 67 additions & 0 deletions .github/workflows/render-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Render README

on:
push:
branches: [main]
paths:
- 'data/**'
- 'scripts/render_readme.py'
pull_request:
paths:
- 'data/**'
- 'scripts/render_readme.py'
workflow_dispatch:

jobs:
render:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml

- name: Validate YAML schema
run: python scripts/validate_data.py

- name: Render README.md
run: python scripts/render_readme.py

- name: Check for changes
id: check_changes
run: |
if git diff --quiet README.md; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi

- name: Commit and push if changed
if: steps.check_changes.outputs.changed == 'true' && github.event_name != 'pull_request'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add README.md
git commit -m "docs: auto-render README.md from data"
git push

- name: Comment on PR if changes needed
if: steps.check_changes.outputs.changed == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '⚠️ README.md needs to be regenerated. Please run `python scripts/render_readme.py` and commit the changes.'
})
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
ENV/
env/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Temporary files
*.tmp
*.bak
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Contributing

This repository uses a data-driven approach to maintain the list of C# Source Generators.

## Structure

- **`data/repositories.yml`** - The single source of truth containing all repository information
- **`scripts/render_readme.py`** - Python script that generates README.md from the YAML data
- **`scripts/validate_data.py`** - Validation script to ensure data quality
- **`scripts/extract_data.py`** - Helper script to extract data from existing README (used during migration)

## Making Changes

### Adding a New Repository

1. Edit `data/repositories.yml`
2. Add your repository under the appropriate category:

```yaml
categories:
your-category:
repositories:
- name: YourGenerator
url: https://github.com/yourusername/yourgenerator
description: Brief description of what your generator does
```

3. Run validation: `python scripts/validate_data.py`
4. Render README: `python scripts/render_readme.py`
5. Commit both `data/repositories.yml` and `README.md`

### Adding a New Category

1. Edit `data/repositories.yml`
2. Add your category:

```yaml
categories:
your-new-category:
name: Your New Category Name
repositories:
- name: FirstRepo
url: https://github.com/...
description: ...
```

3. Update the table of contents in the YAML file if needed
4. Follow steps 3-5 from "Adding a New Repository"

## Automation

The repository includes a GitHub Actions workflow (`.github/workflows/render-readme.yml`) that:

- **On Push**: Validates data and auto-generates README.md
- **On Pull Requests**: Validates data and comments if README needs regeneration

## Validation

The validation script checks for:

- Valid GitHub URLs
- Required fields (name, url)
- Duplicate repositories
- Empty descriptions
- Proper YAML structure

Run `python scripts/validate_data.py` before committing to ensure data quality.
367 changes: 188 additions & 179 deletions README.md

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Testing the Refactored Structure

This document demonstrates how to use the new data-driven structure.

## Quick Test

1. **Validate the current data:**
```bash
python scripts/validate_data.py
```

2. **Render the README:**
```bash
python scripts/render_readme.py
```

3. **Add a new repository** (edit `data/repositories.yml`):
```yaml
categories:
your-category:
repositories:
- name: NewGenerator
url: https://github.com/user/repo
description: Description of the generator
```

4. **Validate and render:**
```bash
python scripts/validate_data.py && python scripts/render_readme.py
```

## Automated Workflow

When you push changes to `data/repositories.yml`:

1. GitHub Actions runs validation
2. If validation passes, README.md is automatically regenerated
3. Changes are committed back to the repository

## Local Development

Install dependencies:
```bash
pip install -r requirements.txt
```

Run validation:
```bash
python scripts/validate_data.py
```

Render README:
```bash
python scripts/render_readme.py
```
Loading