Daily rebuild (public) #66
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: Daily rebuild (public) | |
| # Re-validates, rebuilds index/README/translations/stats from the current | |
| # prompts/ directory. Idempotent — but the build-index step writes a fresh | |
| # `generated_at` ISO timestamp, so every run produces a 1-line diff that | |
| # turns into a real commit. This keeps the GitHub commit graph green and | |
| # the repo eligible for GitHub Trending. | |
| # | |
| # Content sourcing (the X scrape) lives in the PRIVATE `gptimage2-ops` repo | |
| # and runs 1h earlier. Drafts there are reviewed manually and committed | |
| # to this repo as regular PRs. | |
| on: | |
| schedule: | |
| - cron: '0 9 * * *' # 09:00 UTC daily (= 17:00 Beijing, 02:00 PT, 04:00 CT) | |
| workflow_dispatch: # also allow manual trigger from the Actions tab | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 1 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile=false | |
| - name: Validate | |
| run: pnpm validate | |
| - name: Build index (always changes timestamp) | |
| run: pnpm build:index | |
| - name: Build README | |
| env: | |
| SITE_URL: https://gptimage2.veilo.dev | |
| run: pnpm build:readme | |
| - name: Translate (skip if OPENAI_API_KEY missing) | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| if [ -n "$OPENAI_API_KEY" ]; then | |
| pnpm translate | |
| else | |
| echo "OPENAI_API_KEY not set, skipping translate step" | |
| fi | |
| - name: Stats | |
| run: pnpm stats || true | |
| - name: Touch last-rebuilt marker (forces non-empty diff) | |
| run: | | |
| mkdir -p docs | |
| date -u '+%Y-%m-%dT%H:%M:%SZ' > docs/last-rebuilt.txt | |
| - name: Commit changes | |
| run: | | |
| git config user.name "gptimage2-bot" | |
| git config user.email "bot@gptimage2.veilo.dev" | |
| git add -A | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "chore: daily rebuild ($(date -u +%Y-%m-%d))" | |
| git push | |
| fi |