Skip to content

Scrape & Update Docs #6

Scrape & Update Docs

Scrape & Update Docs #6

Workflow file for this run

name: Scrape & Update Docs
on:
schedule:
# Tous les jours à 3h UTC
- cron: "0 3 * * *"
workflow_dispatch:
inputs:
scraper:
description: "Scraper à lancer"
required: false
default: "all"
type: choice
options:
- all
- paper_docs
- paper_javadoc
- bukkit
- minecraft_wiki
- index_only
jobs:
scrape:
runs-on: ubuntu-latest
permissions:
contents: write # Pour pouvoir push dans minecraft-mcp-docs
steps:
- name: Checkout scraper repo
uses: actions/checkout@v4
with:
path: minecraft-mcp-scraper
- name: Checkout docs repo
uses: actions/checkout@v4
with:
repository: Vortex-SMP/minecraft-mcp-docs # À adapter avec ton vrai nom d'orga
path: minecraft-mcp-docs
token: ${{ secrets.DOCS_REPO_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: minecraft-mcp-scraper/requirements.txt
- name: Install dependencies
working-directory: minecraft-mcp-scraper
run: pip install -r requirements.txt
- name: Run main scrapers
if: ${{ github.event.inputs.scraper != 'plugins_only' && github.event.inputs.scraper != 'index_only' }}
working-directory: minecraft-mcp-scraper
run: |
SCRAPER="${{ github.event.inputs.scraper || 'all' }}"
python run.py --scraper "$SCRAPER" --no-index
- name: Run plugin scrapers
if: ${{ github.event.inputs.scraper == 'all' || github.event.inputs.scraper == 'plugins_only' || github.event.inputs.scraper == '' }}
working-directory: minecraft-mcp-scraper
run: python run_plugins.py
- name: Build SQLite index
working-directory: minecraft-mcp-scraper
run: python run.py --scraper index_only
- name: Push updated docs & index
working-directory: minecraft-mcp-docs
run: |
git config user.name "Startoto1007"
git config user.email "startoto1007@gmail.com"
git add sources/ plugins/ index.db
if git diff --staged --quiet; then
echo "Aucun changement détecté, pas de commit."
else
git commit -m "chore: update scraped docs [$(date -u '+%Y-%m-%d %H:%M UTC')]"
git push
fi
- name: Notify Discord on failure
if: failure()
run: |
# Décommente et configure DISCORD_WEBHOOK dans les secrets GitHub
# curl -X POST "${{ secrets.DISCORD_WEBHOOK }}" \
# -H "Content-Type: application/json" \
# -d "{\"content\": \"⚠️ Le scraper minecraft-mcp a échoué ! Voir : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
echo "::error::Le scraper a échoué."