๐ GitHub Stars Indexๅๆญฅ #40
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: ๐ GitHub Stars Indexๅๆญฅ | |
| on: | |
| # โโ ๅฎๆถ่งฆๅ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # ไฟฎๆนไธๆน cron ่กจ่พพๅผไปฅ่ชๅฎไนๆง่ก้ข็๏ผUTC ๆถ้ด๏ผ | |
| # ็คบไพ: | |
| # "0 2 * * 1" โ ๆฏๅจไธ UTC 02:00๏ผๅไบฌๆถ้ด 10:00๏ผ | |
| # "0 18 * * *" โ ๆฏๅคฉ UTC 18:00๏ผๅไบฌๆถ้ดๆฌกๆฅ 02:00๏ผ | |
| # "0 2 1 * *" โ ๆฏๆ 1 ๆฅ UTC 02:00 | |
| # cron ๅจ็บฟ็ๆๅจ: https://crontab.guru | |
| schedule: | |
| - cron: "18 18 * * *" # โ ๅจๆญคไฟฎๆนไฝ ็ๅฎๆถ้ข็ | |
| # โโ ๆๅจ่งฆๅ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| workflow_dispatch: | |
| inputs: | |
| force_rebuild: | |
| description: "ๅผบๅถ้ๆฐ็ๆๆๆๆ่ฆ๏ผ้ๅปบ JSON ๆฐๆฎ้๏ผ" | |
| required: false | |
| default: "false" | |
| type: choice | |
| options: | |
| - "false" | |
| - "true" | |
| test_limit: | |
| description: "ๆต่ฏๆจกๅผ๏ผ้ๅถๅค็็้กน็ฎๆฐ้๏ผๅฆๅกซ 5 ๅๅชๅค็ 5 ไธชๆฐ้กน็ฎ๏ผ็็ฉบไธ้ๅถ๏ผ" | |
| required: false | |
| default: "" | |
| type: string | |
| permissions: | |
| contents: write # ๅ ่ฎธ Action ๆไบคๆไปถๅฐๆฌไปๅบ | |
| jobs: | |
| sync: | |
| name: ๆๅ Stars ๅนถ็ๆๆ่ฆ | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 # ่ถ ๆถไฟๆค๏ผStars ่พๅคๆถๅฏ่ฝ่ๆถ้ฟ๏ผ | |
| steps: | |
| # โโ 1. ๆฃๅบไปฃ็ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| - name: Checkout ไปๅบ | |
| uses: actions/checkout@v4 | |
| # โโ 2. ่ฎพ็ฝฎ Python ็ฏๅข โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| - name: ่ฎพ็ฝฎ Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| # โโ 3. ๅฎ่ฃ ไพ่ต โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| - name: ๅฎ่ฃ ไพ่ต | |
| run: pip install -r requirements.txt | |
| # โโ 4. ๅฏ้๏ผๅผบๅถ้็ฝฎๆฐๆฎ้ โโโโโโโโโโโโโโโโโโโโโโ | |
| - name: ้็ฝฎๆฐๆฎ้๏ผไป ๅจ force_rebuild=true ๆถๆง่ก๏ผ | |
| if: github.event.inputs.force_rebuild == 'true' | |
| run: | | |
| echo "โ ๏ธ ๅผบๅถ้ๅปบๆจกๅผ๏ผๅ ้ค็ฐๆๆฐๆฎ" | |
| rm -rf data/stars.json | |
| # โโ 5. ๆง่กๅๆญฅ่ๆฌ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| - name: ๅๆญฅ GitHub Stars | |
| env: | |
| # โโ Secrets๏ผๆบๅฏ๏ผๅ ๅฏไฟๅญ๏ผโโ | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Actions ่ชๅจๆณจๅ ฅ๏ผๆ ้ๆๅจๆทปๅ | |
| AI_API_KEY: ${{ secrets.AI_API_KEY }} # AI API Key | |
| VAULT_PAT: ${{ secrets.VAULT_PAT }} # Vault ไปๅบๅๆ้ PAT๏ผVault ๅๆญฅๆถๅฟ ๅกซ๏ผ | |
| # โโ Variables๏ผ้ๆบๅฏ๏ผๆๆ๏ผๅจ Settings โ Variables ไธญ้ ็ฝฎ๏ผโโ | |
| GH_USERNAME: ${{ vars.GH_USERNAME }} # ่ฆๆๅ Stars ็ GitHub ็จๆทๅ | |
| AI_BASE_URL: ${{ vars.AI_BASE_URL }} # AI ๆฅๅฃๅฐๅ | |
| AI_MODEL: ${{ vars.AI_MODEL }} | |
| MAX_CONCURRENCY: ${{ vars.MAX_CONCURRENCY }} | |
| OUTPUT_FILENAME: ${{ vars.OUTPUT_FILENAME }} | |
| VAULT_SYNC_ENABLED: ${{ vars.VAULT_SYNC_ENABLED }} | |
| VAULT_REPO: ${{ vars.VAULT_REPO }} | |
| VAULT_SYNC_PATH: ${{ vars.VAULT_SYNC_PATH }} | |
| TEST_LIMIT: ${{ github.event.inputs.test_limit }} | |
| PAGES_SYNC_ENABLED: ${{ vars.PAGES_SYNC_ENABLED }} | |
| run: python scripts/sync_stars.py | |
| # โโ 6. ๆไบคๅๆดๅฐๆฌไปๅบ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| - name: ๆไบคๅนถๆจ้ๅๆด | |
| run: | | |
| set -e | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add data/stars.json | |
| if git diff --staged --quiet; then | |
| echo "โ ๆ ๆฐๅ ๅฎน๏ผ่ทณ่ฟๆไบค" | |
| exit 0 | |
| fi | |
| git commit -m "๐ค ่ชๅจๆดๆฐ GitHub Stars ๆ่ฆ [$(date -u '+%Y-%m-%d %H:%M UTC')]" | |
| echo "๐ ๅๆญฅ่ฟ็จๆๆฐไปฃ็ ..." | |
| git fetch origin main | |
| git rebase origin/main | |
| echo "๐ ๆจ้ๆดๆฐ..." | |
| git push origin main | |
| # โโ 7. ้จ็ฝฒๅฐ GitHub Pages โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| - name: ้จ็ฝฒๅฐ GitHub Pages | |
| if: vars.PAGES_SYNC_ENABLED == 'true' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: dist # ๅๆญฅ dist ๆไปถๅคน็ๅ ๅฎน | |
| branch: gh-pages # ็ฎๆ ๅๆฏ | |
| clean: true # ไฟๆๅๆฏๆดๆด |