Update Blog Posts #8
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: Update Blog Posts | |
| on: | |
| schedule: | |
| # Run daily at 6 AM UTC | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| update-posts: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install requests beautifulsoup4 | |
| - name: Fetch and update blog posts | |
| run: python scripts/update_blog_posts.py | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git diff --quiet docs/index.html || echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| if: steps.git-check.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs/index.html | |
| git commit -m "Update blog posts from Zac Smith's author page" | |
| git push |