Update Zed Extension Downloads #1205
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: Update Zed Extension Downloads | |
| on: | |
| schedule: | |
| - cron: "0 * * * *" # Runs hourly | |
| workflow_dispatch: | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: sudo apt-get install -y jq curl | |
| - name: Fetch Zed page | |
| run: | | |
| curl -s https://zed.dev/extensions/react-type-kit-snippets -o page.html | |
| - name: Extract downloads count | |
| run: | | |
| # Extract number (e.g., "2,341 downloads") from HTML | |
| DOWNLOADS=$(grep -oP 'Downloads: \K[0-9,]+' page.html | head -1) || DOWNLOADS="0" | |
| echo "{\"downloads\": \"$DOWNLOADS\"}" > downloads.json | |
| cat downloads.json | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add downloads.json | |
| git commit -m "Update downloads count" || echo "No changes" | |
| git push |