Skip to content

Update Index Stars & Repo Stats (auto) #657

Update Index Stars & Repo Stats (auto)

Update Index Stars & Repo Stats (auto) #657

name: Update Index Stars & Repo Stats (auto)
on:
schedule:
- cron: "17 * * * *" # hourly
workflow_dispatch:
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create bot app token
id: bot-app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.A0_BOT_APP_ID }}
private-key: ${{ secrets.A0_BOT_PRIVATE_KEY }}
- name: Wait for older index-mutating workflows
env:
GITHUB_TOKEN: ${{ steps.bot-app-token.outputs.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
python scripts/wait_for_index_serialization.py
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Download index.json from tagged Release
env:
GITHUB_TOKEN: ${{ steps.bot-app-token.outputs.token }}
INDEX_RELEASE_TAG: generated-index
run: |
python scripts/download_index_release.py
- name: Scan repo stats (write repo_stats_updates.json)
env:
GITHUB_TOKEN: ${{ steps.bot-app-token.outputs.token }}
STARS_CHUNK_SIZE: "50"
run: |
python scripts/update_index_stars.py --mode scan
- name: Refresh index.json from tagged Release
env:
GITHUB_TOKEN: ${{ steps.bot-app-token.outputs.token }}
INDEX_RELEASE_TAG: generated-index
run: |
python scripts/download_index_release.py
- name: Apply repo stats updates to refreshed index.json
run: |
python scripts/update_index_stars.py --mode apply
- name: Publish updated index.json to Release (replace asset)
env:
GITHUB_TOKEN: ${{ steps.bot-app-token.outputs.token }}
INDEX_RELEASE_TAG: generated-index
run: |
python scripts/publish_index_release.py