Skip to content

Fetch Latest Blogs #699

Fetch Latest Blogs

Fetch Latest Blogs #699

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
- 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 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"
fi
- name: Push updated json file
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}