feat: add 9 AI-powered GitHub Actions workflows#683
feat: add 9 AI-powered GitHub Actions workflows#683Tony363 wants to merge 2 commits intoLight-Heart-Labs:mainfrom
Conversation
Import and adapt AI automation workflows for DreamServer: **AI Code Review (3):** - claude-review-phase1: Comment-only PR review - claude-review-phase2: Sensitive file detection + review - claude-review-phase3: Draft PR with suggested fixes **Scheduled Automation (3):** - nightly-code-review: Daily code improvements (3 AM UTC) - nightly-docs-update: Documentation sync (4 AM UTC) - autonomous-code-scanner: Multi-scanner with formatting, security, type hints, and docstring generation (2 AM UTC) **Issue & Release (3):** - ai-issue-triage: Auto-label new issues - issue-to-pr: Auto-implement issues as draft PRs - release-notes: AI-generated release notes Also includes: - 3 prompt files (.github/prompts/) - 5 helper scripts (.github/scripts/) - 3 test event files for local testing with `act` All workflows use Anthropic API only. Protected file patterns enforce guardrails for dream-server/installers/, dream-server/dream-cli, and dream-server/config/. Shell validation (shellcheck, bash -n) added for DreamServer's Bash-heavy codebase. Required secrets: ANTHROPIC_API_KEY, PAT_TOKEN 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Post-Merge Testing InstructionsAfter merging, test each workflow category. All scheduled/event-triggered workflows only become available once they exist on 1. Required Secrets SetupConfigure these in Settings → Secrets and variables → Actions → New repository secret:
2. Test Scheduled Workflows (safe — all have
|
| Workflow | Estimated Cost |
|---|---|
| Nightly code review (dry run) | ~$3-8 |
| Nightly docs update (dry run) | ~$1-3 |
| Autonomous scanner (P0+P1 only) | ~$2.50 |
| AI issue triage | ~$1.50 |
| Issue-to-PR | ~$5-15 |
| Release notes | ~$1.50 |
| PR review (phase 1) | ~$1.50 |
| Total for full test suite | ~$16-34 |
- Phase 2: Add fork detection, skip claude-review and review-summary for fork PRs (no secrets available), add pull-requests: write permission - Phase 3: Skip entire workflow for fork PRs via condition on security-check job (fork PRs can't post comments or access secrets) - Fix test_parses_unified_apu: use get_gpu_tier() for unified APU name fallback when product_name is absent (was returning generic "AMD Radeon" instead of "Strix Halo 90+") Co-Authored-By: Claude <noreply@anthropic.com>
Lightheartdevs
left a comment
There was a problem hiding this comment.
Tony — love the ambition here. AI-powered CI is the right direction and the guardrails (protected files, secret scanning, diff size gates) are well thought out. But this needs significant rework before it can merge.
Critical — must fix
-
All 8 third-party actions use mutable tags (
@v4,@v1,@v6). None pinned to SHA. If any upstream action is compromised,ANTHROPIC_API_KEYandPAT_TOKENare exposed. Pin every action to full commit SHA (e.g.,actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11). Use Dependabot to keep them updated. -
Triple PR review triggering. Phases 1, 2, and 3 all trigger on
pull_request: [opened, ready_for_review]. Every PR gets 3 concurrent Claude reviews at ~$2-4 each. Consolidate into a single workflow, or make Phase 3 (auto-fix) opt-in via a label likeai-fix. -
Recursive trigger risk. Phase 3 and the scanners create PRs using
PAT_TOKEN. PRs from a PAT trigger other workflows (unlikeGITHUB_TOKEN). The bot-actor guards check forclaude[bot]butpeter-evans/create-pull-requestwith a PAT shows the PAT owner as actor, not a bot. Could create infinite review loops. -
issue-to-pr.ymlis open to any user. Anyone who opens an issue triggers Claude to write code and create a PR. Prompt injection via issue body is a real attack vector. Gate this behind a label (e.g.,ai-implement) that only maintainers can apply.
Medium — should fix
- Secret validation anti-pattern. Multiple workflows use
if [ -z "${{ secrets.X }}" ]which expands the secret into the shell script. Useenv:blocks instead:
env:
HAS_KEY: ${{ secrets.ANTHROPIC_API_KEY != '' }}-
gpu.pycode change (+6/-1) mixed into a CI workflow PR. Split into a separate PR. -
release-notes.ymltool syntax. UsesBash(git log:*)(colon) while other workflows useBash(git log *)(space). Verify which formatclaude-code-actionexpects.
Cost concern
With all workflows active:
- 3 nightly scheduled workflows: $9-71/day
- Per-PR reviews (3 phases): $6-11.50 each
- Monthly estimate at current activity: $270-2,130
For a bootstrapped project, that's significant. Consider shipping the review phase (1 consolidated workflow) and the release notes generator first. The nightly scanners and issue-to-PR can come later once you have budget headroom.
Recommendation
Split this into smaller PRs:
- PR A: AI code review (single consolidated phase) + release notes — ship first
- PR B: Nightly scanners — ship when budget allows
- PR C: Issue-to-PR — ship after label-gating and injection hardening
The foundation is solid. Just needs tightening before it touches production.
|
Splitting this PR into 3 smaller PRs per review feedback from @Lightheartdevs:
All 7 review items addressed in the split PRs:
Closing in favor of the split PRs. |
Summary
Imports and adapts 9 AI-powered GitHub Actions workflows from the Ocelot project for DreamServer's Bash/Python/React architecture.
AI Code Review (PR-triggered)
Scheduled Automation (nightly cron)
Issue & Release (event-triggered)
Support Files
.github/prompts/) for nightly-code-review, nightly-docs-update, issue-to-pr.github/scripts/) for the autonomous scanner (anthropic_helper, type hint and docstring generators/appliers).github/test-events/) for local testing withactKey Design Decisions
ANTHROPIC_API_KEYshellcheck+bash -nto guardrails and allowed tools (DreamServer is heavily Bash)dream-server/installers/,dream-server/dream-cli,dream-server/config/blocked from AI modificationsSetup: Required GitHub Secrets
Only 2 secrets need to be configured in Settings → Secrets and variables → Actions:
ANTHROPIC_API_KEYPAT_TOKENcontents: write+pull_requests: write+issues: writescopes for this repoGitHub Labels (already created)
The following labels were already created on the repo:
installer,cli,dashboard,dashboard-api,extensions,docker,scripts,tests,ci-cdpriority:high,priority:medium,priority:lowai-generated,needs-human-review,force-review,nightly-review,issue-fix,auto-formatting,auto-security,auto-type-hints,auto-documentationPost-Merge Verification
After merging, test each workflow category:
dry_run→ Runai-issue-triageshould auto-labelrelease-notesshould fireTest plan
actionlint(zero errors)py_compilenightly-code-reviewpreflight job — detected 12 changed files viaactnightly-docs-updatedetect-changes job — found README.md, CLAUDE.md affected viaactautonomous-code-scannersecurity-check job — found 55 Python, 42 Shell files viaactautonomous-code-scannerscan-formatting — reformatted 52/55 files (Docker test)autonomous-code-scannerscan-security — Bandit found 18 medium findings (Docker test)issue-to-prvalidate job — secrets + dedup check passed viaactissue-to-prguardrails — all 5 checks work: protected files, secrets, size gate, py_compile, bash -n (Docker test)claude-review-phase2detect-high-stakes — correctly identified patterns viaactclaude-review-phase3security-check — validated after fixing grep patterns viaactrelease-notesfull dry-run — all steps resolve viaact🤖 Generated with Claude Code