Skip to content

Fetch Latest Blogs #826

Fetch Latest Blogs

Fetch Latest Blogs #826

name: Fetch Latest Blogs
on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
jobs:
fetch_latest_blogs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: pip install pyyaml PyGithub
- name: Run Python Script
env:
FETCH_BLOGS: ${{ secrets.FETCH_BLOGS}}
run: python fetch_blogs.py
- name: Commit and Push files
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Action"
git add .
if git diff-index --quiet HEAD --; then
echo "No new articles to push. Exiting without committing"
exit 0
else
git commit -m "Add json file"
git pull --rebase origin main
git push
fi