Files
cursor-ai-downloads/.github/workflows/update-cursor-links.yml
2025-09-02 09:38:00 +08:00

77 lines
2.3 KiB
YAML

name: Update Cursor Download Links
on:
schedule:
- cron: '0 * * * *' # Run hourly at minute 0
workflow_dispatch: # Allow manual triggering
permissions:
contents: write
jobs:
update-links:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: oslook/cursor-download-hub
token: ${{ secrets.API_TOKEN_GITHUB }}
ref: main
path: output/cursor-download-hub
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run update script
run: bun src/update-cursor-links.ts
- name: Run update script
run: ./scripts/download_all_cursors.sh version-history.json
- name: Check for changes
id: git-check
run: |
git add README.md version-history.json cursor_products
if ! git diff --staged --quiet; then
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push if changed
if: steps.git-check.outputs.changes == 'true'
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "GitHub Actions"
git add README.md version-history.json cursor_products
git commit -m "Update Cursor download links"
git push
- name: copy file
run: cp -rf version-history.json output/cursor-download-hub/public/
- name: Pushes to another repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: 'output/cursor-download-hub'
destination-github-username: "oslook"
destination-repository-name: 'cursor-download-hub'
user-email: 41898282+github-actions[bot]@users.noreply.github.com
user-name: github-actions[bot]
commit-message: 'Auto updated'
target-branch: main