Rosetta Code Auto-Scraper #2
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 | |
| steps: | |
| - name: Checkout Awesome-Zen-C | |
| uses: actions/checkout@v4 | |
| with: | |
| path: 'awesome' | |
| - name: Checkout Website Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'z-libs/zenc-lang.org' | |
| token: ${{ secrets.WEBSITE_REPO_TOKEN }} | |
| path: 'website' | |
| - 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 rosetta/ | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "chore: auto-sync Rosetta Code" && git push) | |
| - name: Sync to Website Repo | |
| run: | | |
| mkdir -p website/docs.zenc-lang.org/content/examples/rosetta/ | |
| rsync -avz --delete --exclude='_index.md' awesome/website_out/ website/docs.zenc-lang.org/content/examples/rosetta/ | |
| cd website | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs.zenc-lang.org/content/examples/rosetta/ | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "docs: sync examples from Awesome-Zen-C" && git push) |