Skip to content

auto update

auto update #2521

Workflow file for this run

name: auto update
on:
push:
branches: ['main']
schedule:
- cron: '0 * * * *'
jobs:
generate:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: install dependencies
run: |
npm i -g pnpm
pnpm i --no-frozen-lockfile
continue-on-error: false # 确保失败时停止工作流
- name: generate RSS and push notifications
run: |
if [ -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]; then
echo "TELEGRAM_BOT_TOKEN is missing"
exit 1
fi
if [ -z "${{ secrets.TELEGRAM_CHAT_ID }}" ]; then
echo "TELEGRAM_CHAT_ID is missing"
exit 1
fi
npm run rss
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
DING_TALK_BOT_TOKEN: ${{ secrets.DING_TALK_BOT_TOKEN }}
- name: update README
run: |
npx jtm run --watch false
continue-on-error: false # 确保失败时停止工作流
- name: commit the all info
id: commit_msg
run: |
if git status -s | grep -q .; then
echo "Changes detected, committing..."
git status -s
echo "check_result=success" >> $GITHUB_OUTPUT
else
echo "No changes to commit"
exit 0
fi
git config --global user.email "eyelly.wu@gmail.com"
git config --global user.name "GitHub Workflow"
git add .
git commit -m 'chore: automatic update of GitHub workflow'
- name: git push
if: steps.commit_msg.outputs.check_result == 'success'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PUBLISH_TOKEN }}