* fix: add id-token write permission and fix invalid inputs in GC workflow The claude-code-action@v1 uses OIDC for OAuth token auth, which requires id-token: write in workflow permissions. Without it ACTIONS_ID_TOKEN_REQUEST_URL is not set and the action fails after 3 retry attempts. Also moves model and allowed_tools from unsupported top-level inputs into claude_args where they are valid CLI flags for claude-code-action@v1. * fix(gc): show agent output and explicit dry-run issue posting - Add show_full_output: true so Claude responses appear in CI logs - Replace vague dry-run instruction with explicit gh issue create/comment commands so output has a concrete destination (tracking issue) - Bake DRY_RUN value into prompt at workflow-expansion time to eliminate ambiguity about env var reading * docs: mark cloud-auth-architecture.md as superseded by ADR-003 * fix(docker): guard community seeder cd and add ENCRYPTION_MASTER_KEY default - Wrap `cd $SEEDERS_DIR/community` in an existence check so the data-engine container no longer crashes when local-seeders/community/ is an empty or uncloned nested git repo. The container was entering Docker's exponential-backoff restart loop (2s→60s) on every boot. - Add ENCRYPTION_MASTER_KEY to the wwv environment block with a local-dev fallback, matching the AUTH_SECRET pattern. Without it the Next.js instrumentation hook throws at startup and the app never serves a request.
117 lines
4.1 KiB
YAML
117 lines
4.1 KiB
YAML
name: Garbage Collector
|
||
|
||
on:
|
||
schedule:
|
||
- cron: '0 6 * * *' # 06:00 UTC daily
|
||
workflow_dispatch:
|
||
inputs:
|
||
dry_run:
|
||
description: 'Dry run — report findings only, open no PRs or Issues (recommended for first 3–5 days)'
|
||
required: false
|
||
default: 'true'
|
||
type: choice
|
||
options: ['true', 'false']
|
||
days_branch:
|
||
description: 'Days before a branch is considered stale'
|
||
required: false
|
||
default: '90'
|
||
days_comment:
|
||
description: 'Days before a TODO/FIXME comment is flagged'
|
||
required: false
|
||
default: '180'
|
||
|
||
concurrency:
|
||
group: garbage-collector
|
||
cancel-in-progress: true
|
||
|
||
permissions:
|
||
contents: write
|
||
pull-requests: write
|
||
issues: write
|
||
id-token: write
|
||
|
||
jobs:
|
||
collect:
|
||
runs-on: ubuntu-latest
|
||
timeout-minutes: 15
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GC_BOT_TOKEN }}
|
||
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
|
||
DAYS_BRANCH: ${{ github.event.inputs.days_branch || '90' }}
|
||
DAYS_COMMENT: ${{ github.event.inputs.days_comment || '180' }}
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
with:
|
||
fetch-depth: 0 # full history required for git blame and branch age
|
||
token: ${{ secrets.GC_BOT_TOKEN }} # PAT so pushed branches trigger CI
|
||
|
||
- name: Configure git user
|
||
run: |
|
||
git config user.name 'WorldWideView GC Bot'
|
||
git config user.email '[email protected]'
|
||
|
||
- name: Setup pnpm
|
||
uses: pnpm/action-setup@v4
|
||
|
||
- name: Setup Node.js
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: '22'
|
||
cache: 'pnpm'
|
||
|
||
- name: Install dependencies
|
||
run: pnpm install --frozen-lockfile
|
||
|
||
- name: Run deterministic scan
|
||
run: |
|
||
node scripts/gc-scan.mjs \
|
||
--out gc-findings.json \
|
||
--days-branch=${{ env.DAYS_BRANCH }} \
|
||
--days-comment=${{ env.DAYS_COMMENT }}
|
||
|
||
- name: Upload findings artifact
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: gc-findings-${{ github.run_id }}
|
||
path: gc-findings.json
|
||
retention-days: 30
|
||
|
||
- name: Run Garbage Collector agent
|
||
uses: anthropics/claude-code-action@v1
|
||
with:
|
||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||
show_full_output: true
|
||
prompt: |
|
||
You are the WorldWideView Garbage Collector agent running headless in GitHub Actions.
|
||
|
||
Read `.agents/rules/garbage-collection.md` for your charter and all guard rails.
|
||
Read `gc-findings.json` for the pre-scanned findings produced by `scripts/gc-scan.mjs`.
|
||
|
||
The DRY_RUN environment variable is: ${{ env.DRY_RUN }}
|
||
|
||
## If DRY_RUN is "true":
|
||
Do NOT create any PRs or Issues.
|
||
Instead, find or create the tracking Issue titled "[gc-bot] Daily Scan Reports" (label: gc-bot) in
|
||
the silvertakana/worldwideview repository using the gh CLI:
|
||
|
||
# Find existing tracking issue
|
||
gh issue list --repo silvertakana/worldwideview --label gc-bot --search "[gc-bot] Daily Scan Reports" --json number,title
|
||
|
||
# If it exists, add a comment:
|
||
gh issue comment <number> --repo silvertakana/worldwideview --body "..."
|
||
|
||
# If it doesn't exist, create it:
|
||
gh issue create --repo silvertakana/worldwideview --title "[gc-bot] Daily Scan Reports" --label gc-bot --body "..."
|
||
|
||
The comment body must list every finding with: tier, file, line, description.
|
||
Include the run ID (${{ github.run_id }}) and timestamp at the top.
|
||
|
||
## If DRY_RUN is "false":
|
||
Execute the full sweep procedure described in `.claude/agents/garbage-collector.md`.
|
||
Create Tier A draft PRs and Tier B Issues per the guard rails in `.agents/rules/garbage-collection.md`.
|
||
|
||
Do not scan the codebase yourself. Work only from gc-findings.json.
|
||
claude_args: '--model claude-haiku-4-5-20251001 --allowedTools Bash,Read,Edit,Write,Grep,Glob'
|