|
| 1 | +name: Claude Nightly Enhancements |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run daily at 2 AM UTC |
| 6 | + - cron: '0 2 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + dry_run: |
| 10 | + description: 'Dry run (plan only, no PR)' |
| 11 | + required: false |
| 12 | + default: 'false' |
| 13 | + type: choice |
| 14 | + options: |
| 15 | + - 'true' |
| 16 | + - 'false' |
| 17 | + |
| 18 | +jobs: |
| 19 | + nightly: |
| 20 | + uses: duyet/github-actions/.github/workflows/claude-schedule.yml@main |
| 21 | + permissions: |
| 22 | + actions: read |
| 23 | + contents: write |
| 24 | + issues: write |
| 25 | + pull-requests: write |
| 26 | + id-token: write |
| 27 | + secrets: |
| 28 | + api_key: ${{ secrets.OPENROUTER_API_KEY }} |
| 29 | + bot_github_token: ${{ secrets.DUYETBOT_GITHUB_TOKEN }} |
| 30 | + with: |
| 31 | + dry_run: ${{ inputs.dry_run }} |
| 32 | + # Custom prompt for comprehensive code enhancement |
| 33 | + prompt: | |
| 34 | + You are running a nightly code enhancement job for the clickhouse-monitoring repository. |
| 35 | +
|
| 36 | + ## Your Task |
| 37 | + Analyze the codebase and create improvements following this workflow: |
| 38 | +
|
| 39 | + ### 1. Plan Phase |
| 40 | + - Analyze the codebase for opportunities in: |
| 41 | + - **Security**: Potential vulnerabilities, unsafe patterns, input validation issues |
| 42 | + - **Performance**: Component memoization, query optimization, memory usage |
| 43 | + - **Bugs**: Type errors, edge cases, error handling gaps |
| 44 | + - **Refactoring**: Code duplication, SOLID violations, inconsistent patterns |
| 45 | + - **UI/UX**: Accessibility improvements, responsive design issues, user experience enhancements |
| 46 | + - **Testing**: Missing test coverage, flaky tests |
| 47 | + - **Documentation**: Outdated docs, missing JSDoc comments |
| 48 | +
|
| 49 | + - Prioritize findings by impact (high/medium/low) |
| 50 | + - Create a structured plan in a GitHub issue |
| 51 | +
|
| 52 | + ### 2. Implementation Phase |
| 53 | + - For high-priority items that are safe to automate: |
| 54 | + - Implement the fixes using Write and Edit tools |
| 55 | + - Follow the existing code patterns (Biome formatting, TypeScript strict mode) |
| 56 | + - Add tests for any bug fixes or new functionality |
| 57 | + - Update documentation as needed |
| 58 | +
|
| 59 | + ### 3. Test Phase |
| 60 | + - Run `bun test` to verify unit tests pass |
| 61 | + - Run `bun run lint` to verify code quality |
| 62 | + - Check for TypeScript errors |
| 63 | +
|
| 64 | + ### 4. PR Creation Phase |
| 65 | + - Create a pull request with your changes |
| 66 | + - PR title format: `nightly(nlp): [category] brief description` |
| 67 | + - Include in the PR body: |
| 68 | + - Summary of changes |
| 69 | + - Link to the planning issue |
| 70 | + - Testing performed |
| 71 | + - Co-authored-by: duyetbot <noreply@anthropic.com> |
| 72 | +
|
| 73 | + ## Important Notes |
| 74 | + - Focus on safe, non-breaking changes |
| 75 | + - Run tests before creating PR |
| 76 | + - Use semantic branch names: `nightly/[category]-description` |
| 77 | + - Always co-author commits with duyetbot |
| 78 | + - If dry_run is 'true', only create the planning issue, do not implement or create PR |
| 79 | +
|
| 80 | + ## Repository Context |
| 81 | + - Next.js 16 app with React 19 and TypeScript |
| 82 | + - ClickHouse monitoring dashboard with client-side data fetching |
| 83 | + - Uses SWR for caching, Recharts for visualization |
| 84 | + - Static site generation, no SSR |
| 85 | + - Biome for linting, Bun as package manager |
| 86 | + - Multi-version ClickHouse support (v24.5-v25.6) |
| 87 | +
|
| 88 | + Begin your analysis now. |
| 89 | +
|
| 90 | + # File patterns to analyze (exclude tests, mocks, node_modules) |
| 91 | + file_patterns: | |
| 92 | + **/*.ts |
| 93 | + **/*.tsx |
| 94 | + !**/__tests__/** |
| 95 | + !**/*.test.ts |
| 96 | + !**/*.test.tsx |
| 97 | + !**/*.mock.ts |
| 98 | + !**/node_modules/** |
| 99 | +
|
| 100 | + # Enable write tools for implementation |
| 101 | + allowed_tools: Read,Grep,Glob,Write,Edit,Bash,Skill |
| 102 | + |
| 103 | + # Extended timeout for comprehensive analysis |
| 104 | + timeout_minutes: 90 |
| 105 | + |
| 106 | + # Use the preset model optimized for GitHub Actions |
| 107 | + model: "@preset/claude-code-github-action" |
0 commit comments