Skip to content

Sync Hashnode Articles #5833

Sync Hashnode Articles

Sync Hashnode Articles #5833

Workflow file for this run

name: Sync Hashnode Articles
on:
schedule:
# Run every hour
- cron: '0 * * * *'
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install requests
- name: Sync Hashnode articles
env:
HASHNODE_TOKEN: ${{ secrets.HASHNODE_TOKEN }}
run: |
python sync_hashnode.py
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit and push changes
run: |
git add articles/
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "🔄 Sync articles from Hashnode [$(date +'%Y-%m-%d %H:%M:%S')]"
git push
echo "✅ Changes pushed successfully"
fi