Skip to content

Schedule Publisher #2468

Schedule Publisher

Schedule Publisher #2468

Workflow file for this run

name: Schedule Publisher
on:
schedule:
# Run every hour at minute 0
- cron: '0 * * * *'
workflow_dispatch:
# Allow manual trigger for testing
permissions:
contents: write
jobs:
check-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r scripts/requirements.txt
- name: Run scheduler script
run: |
python scripts/publish_scheduler.py
- name: Commit and Push if changed
run: |
# Configure git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Check for changes
if [[ -n $(git status -s articles/*.md) ]]; then
echo "Changes detected. Committing..."
git add articles/*.md
git commit -m "chore: auto-publish scheduled articles"
git push
else
echo "No articles published."
fi