Shuibaco • 水八口, https://shuiba.co/, https://shuiba.co/feed, 日常; 旅途; 思考 #1780
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: Update readme and feed.opml | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- 'blogs-original.csv' | |
- 'linter.py' | |
- 'opml_generator.py' | |
- 'readme_render.py' | |
- '.github/workflows/updateInfo.yml' | |
schedule: | |
- cron: '0 0 * * MON' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.7 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: 3.12 | |
- name: linter | |
run: | | |
python linter.py | |
- name: update readme | |
run: | | |
python readme_render.py > README.md | |
- name: Generate feed.opml | |
run: | | |
python opml_generator.py | |
- name: Commit files | |
run: | | |
changes=$(git status --porcelain) | |
if [ -z "$changes" ]; then | |
echo "has_changes=false" >> $GITHUB_ENV | |
echo "nothing to commit" | |
else | |
echo "has_changes=true" >> $GITHUB_ENV | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "update README and feed.opml after adding blog(s)" | |
fi | |
- name: Push changes | |
if: env.has_changes == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |