-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 1.78 KB
/
auto-update.yml
File metadata and controls
64 lines (56 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Auto Update Cursor Version Info
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
update-versions:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check for new versions
id: check
env:
TZ: 'Asia/Shanghai'
run: |
if python main.py --check-only --verbose; then
echo "new_version=true" >> $GITHUB_OUTPUT
echo "New version detected"
else
echo "new_version=false" >> $GITHUB_OUTPUT
echo "No new version detected"
fi
- name: Update version data and README
if: steps.check.outputs.new_version == 'true'
env:
TZ: 'Asia/Shanghai'
run: |
python main.py --verbose
- name: Commit and push changes
if: steps.check.outputs.new_version == 'true'
env:
TZ: 'Asia/Shanghai'
run: |
git config --global user.name 'veardk'
git config --global user.email '86230904+veardk@users.noreply.github.com'
git add versions.json README.md
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "auto: update to new version"
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}.git
git push
fi