TokenDrip manual – run 75 attempt 1 #75
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: TokenDrip | |
| run-name: >- | |
| TokenDrip ${{ github.event_name == 'schedule' && 'nightly' || 'manual' }} – run ${{ github.run_number }} attempt ${{ github.run_attempt }} | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" # Run once daily at 00:00 UTC | |
| workflow_dispatch: # Allow manual triggering | |
| inputs: | |
| test_mode: | |
| description: "Set to 1 for 1k-token test quotas" | |
| required: false | |
| default: "0" | |
| jobs: | |
| quota: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Restore cached state/output | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| state | |
| output | |
| key: tokendrip-${{ runner.os }}-${{ github.run_number }} | |
| restore-keys: | | |
| tokendrip-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Run TokenDrip (soft timeout) | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| TOKENDRIP_TEST: ${{ github.event.inputs.test_mode || '0' }} | |
| run: | | |
| # Use unbuffered output (-u) so logs stream immediately. Soft timeout 355m leaves 5 min for uploads. | |
| timeout 355m python3 -u runner.py || echo "Command failed but continuing..." | |
| - name: Upload state artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: state | |
| path: state | |
| - name: Upload output artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: output | |
| path: output | |
| - name: Summarize run | |
| if: always() | |
| run: | | |
| ROWS=$(python - <<'PY' | |
| import csv, pathlib | |
| p = pathlib.Path('output/results_books6-8_v2.csv') | |
| print(sum(1 for _ in csv.reader(p.open())) - 1 if p.exists() else 0) | |
| PY | |
| ) | |
| { | |
| echo "### TokenDrip summary"; | |
| echo "* Rows processed (cumulative): $ROWS"; | |
| echo "* Output artifact: \`output\`"; | |
| echo "* State artifact : \`state\`"; | |
| echo "* Event type : ${{ github.event_name }}"; | |
| echo "* Test mode : ${{ github.event.inputs.test_mode || '0' }}"; | |
| } >> "$GITHUB_STEP_SUMMARY" |