Auto Update Cursor Version Info #2122
This file contains hidden or 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: 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 '[email protected]' | |
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 |