Fetch latest blog posts #6
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: Fetch latest blog posts | |
on: | |
schedule: | |
- cron: "0 0 1 * *" | |
permissions: | |
contents: write | |
jobs: | |
fetch_blog_posts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
check-latest: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install beautifulsoup4 requests lxml | |
- name: Fetch Latest Blog Posts | |
run: | | |
python ".github/script/fetch-blog-post.py" "https://t3l3sc0p3.github.io/feed.xml" | |
if [[ $(git status --porcelain) ]]; then | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add -A | |
git commit -m "Fetch latest blog posts" | |
git push | |
else | |
echo "No new posts found" | |
fi |