mirror of
https://gitee.com/houhuan/TrendRadar.git
synced 2025-12-21 12:57:15 +08:00
fix: 优化定时脚本
This commit is contained in:
parent
e6b95ada77
commit
07491c3b1b
26
.github/workflows/crawler.yml
vendored
26
.github/workflows/crawler.yml
vendored
@ -22,19 +22,21 @@ permissions:
|
||||
jobs:
|
||||
crawl:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-depth: 1
|
||||
clean: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
@ -82,18 +84,6 @@ jobs:
|
||||
git config --global user.name 'GitHub Actions'
|
||||
git config --global user.email 'actions@github.com'
|
||||
|
||||
echo "🔄 Syncing with remote (branch: $BRANCH_NAME)..."
|
||||
git fetch origin $BRANCH_NAME
|
||||
|
||||
# 保存当前更改
|
||||
git stash --include-untracked || echo "Nothing to stash"
|
||||
|
||||
# 同步到远程最新
|
||||
git reset --hard origin/$BRANCH_NAME
|
||||
|
||||
# 恢复本次更改
|
||||
git stash pop || echo "Nothing to pop"
|
||||
|
||||
git add -A
|
||||
|
||||
if git diff --quiet && git diff --staged --quiet; then
|
||||
@ -111,8 +101,8 @@ jobs:
|
||||
echo "✅ Successfully pushed on attempt $i"
|
||||
exit 0
|
||||
}
|
||||
echo "⚠️ Attempt $i failed, waiting $((i*3)) seconds..."
|
||||
sleep $((i * 3))
|
||||
echo "⚠️ Attempt $i failed, waiting $((i*5)) seconds..."
|
||||
sleep $((i * 5))
|
||||
done
|
||||
|
||||
echo "❌ Failed to push after 5 attempts"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user