Rosetta Code Auto-Scraper #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rosetta Code Auto-Scraper | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: {} | |
| jobs: | |
| scrape-and-publish: | |
| runs-on: ubuntu-latest | |
| env: | |
| PYTHONDONTWRITEBYTECODE: 1 | |
| steps: | |
| - name: Checkout Awesome-Zen-C | |
| uses: actions/checkout@v4 | |
| with: | |
| path: 'awesome' | |
| - name: Checkout Docs Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'zenc-lang/docs' | |
| token: ${{ secrets.WEBSITE_REPO_TOKEN }} | |
| path: 'docs' | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Run Rosetta Code Scraper | |
| run: | | |
| cd awesome | |
| python .github/scripts/scrape_rosetta.py | |
| - name: Commit to Awesome Repo | |
| run: | | |
| cd awesome | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add examples/rosetta/ | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "chore: auto-sync Rosetta Code" && git push) | |
| - name: Sync to Docs Repo | |
| run: | | |
| mkdir -p docs/rosetta/ | |
| rsync -avz --delete --exclude='_index.md' awesome/website_out/ docs/rosetta/ | |
| cd docs | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add rosetta/ | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "docs: sync Rosetta Code examples from awesome-zenc" && git push) |