宇宇博客, https://nxysj.top/, , seo; 技术; 笔记 #1777
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/[email protected] | |
- name: Set up Python 3.12 | |
uses: actions/[email protected] | |
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 "[email protected]" | |
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 }} |