Sync Posts #35
This file contains 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: Sync Posts | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
sync-posts: | |
runs-on: ubuntu-latest | |
environment: Website | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: Export WordPress posts | |
env: | |
API_URL: ${{ secrets.API_URL }} | |
USERNAME: ${{ secrets.USERNAME }} | |
APP_PASSWORD: ${{ secrets.APP_PASSWORD }} | |
run: | | |
python export_posts.py | |
- name: Commit and push changes | |
run: | | |
git config --local user.name "${{ secrets.GIT_USER_NAME }}" | |
git config --local user.email "${{ secrets.GIT_USER_EMAIL }}" | |
git add . | |
git commit -m "Update WordPress posts on $(date)" | |
git push | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
branch: sync-wordpress-posts | |
commit-message: "Sync WordPress posts" | |
title: "Daily WordPress Post Sync" | |
body: "This PR syncs posts from WordPress to this repo." |