Skip to content

arXiv-daily-ai-enhanced #19

arXiv-daily-ai-enhanced

arXiv-daily-ai-enhanced #19

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: arXiv-daily-ai-enhanced
on:
schedule:
- cron: "30 16 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
- name: Run script
run: |
source .venv/bin/activate
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
export OPENAI_BASE_URL=${{ secrets.OPENAI_BASE_URL }}
export LANGUAGE="${{ vars.LANGUAGE }}"
export CATEGORIES="${{ vars.CATEGORIES }}"
export MODEL_NAME="${{ vars.MODEL_NAME }}"
bash run.sh
- name: commit
run: |
git config --global user.email "${{ vars.EMAIL }}"
git config --global user.name "${{ vars.NAME }}"
git add .
# 检查是否有变更需要提交
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "update"
- name: Pull latest changes and push
run: |
# 设置Git配置以处理自动合并
git config pull.rebase true
git config rebase.autoStash true
# 尝试推送,如果失败则拉取并重试
for i in {1..3}; do
echo "Push attempt $i"
if git push origin main; then
echo "Push successful"
break
else
echo "Push failed, pulling latest changes..."
git pull origin main --no-edit || true
if [ $i -eq 3 ]; then
echo "Failed to push after 3 attempts"
exit 1
fi
fi
done