profilarr-trash-guides/.github/workflows/generate.yml
renovate[bot] 1adbd07867
chore(deps): update actions/checkout digest to de0fac2 (#21)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Johan <johman10@users.noreply.github.com>
2026-02-09 11:55:51 +02:00

61 lines
1.9 KiB
YAML

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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14.3"
- 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