name: Generate on: schedule: - cron: "31 7 * * *" pull_request: types: [opened, synchronize] workflow_dispatch: jobs: generate: runs-on: ubuntu-latest steps: - name: Checkout this repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - name: Set up Python uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 with: python-version: "3.14.2" - name: Install dependencies run: pip install uv - name: Clone secondary repository run: | git config --global user.email "action@github.com" git config --global user.name "Github Actions" git clone https://github.com/TRaSH-Guides/Guides.git TRaSH-Guides - name: Install dependencies` run: uv sync --extra dev - name: Run Python script run: | uv run scripts/generate.py TRaSH-Guides/docs/json . - name: Run tests run: | uv run pytest tests - name: Check for uncommitted changes (PR) if: github.event_name == 'pull_request' run: | git add regex_patterns/ custom_formats/ profiles/ if ! git diff --staged --quiet; then echo "❌ Error: Generated files have changes that are not committed." echo "Please run the generation script locally and commit the changes:" echo " uv run scripts/generate.py TRaSH-Guides/docs/json ." git diff --staged --stat exit 1 fi echo "✅ No uncommitted changes detected" - name: Commit and push changes (Scheduled/Manual) if: github.event_name != 'pull_request' run: | git add regex_patterns/ custom_formats/ profiles/ git commit -m "Automated update from GitHub Actions" || echo "No changes to commit" git push