lobehub/.github/workflows/claude-auto-testing.yml
Innei fcdaf9d814 🔧 chore: update eslint v2 configuration and suppressions (#12133)
* v2 init

* chore: update eslint suppressions and package dependencies

- Removed several eslint suppressions related to array sorting and reversing from eslint-suppressions.json to clean up the configuration.
- Updated @lobehub/lint package version from 2.0.0-beta.6 to 2.0.0-beta.7 in package.json for improvements and bug fixes.
- Made minor formatting adjustments in vitest.config.mts and various SKILL.md files for better readability and consistency.

Signed-off-by: Innei <tukon479@gmail.com>

* fix: clean up import statements and formatting

- Removed unnecessary whitespace in replaceComponentImports.ts for improved readability.
- Standardized import statements in contextEngineering.ts and createAgentExecutors.ts by adding missing spaces for consistency.

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update eslint suppressions and clean up code formatting

* 🐛 fix: use vi.hoisted for mock variable initialization

Fix TDZ error in persona service test by using vi.hoisted() to ensure
mock variables are available when vi.mock factory runs.

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-02-11 13:04:48 +08:00

76 lines
2.4 KiB
YAML

name: Claude Auto Testing Coverage
description: Automatically add unit tests to improve code coverage
on:
schedule:
# Run daily at 05:30 UTC (13:30 Beijing Time)
- cron: '30 5 * * *'
workflow_dispatch:
inputs:
target_module:
description: 'Specific module to add tests (e.g., packages/database, src/services/user)'
required: false
type: string
concurrency:
group: auto-testing
cancel-in-progress: false
jobs:
add-tests:
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Configure Git
run: |
git config --global user.name "claude-bot[bot]"
git config --global user.email "claude-bot[bot]@users.noreply.github.com"
- name: Copy prompts
run: |
mkdir -p /tmp/claude-prompts
cp .claude/prompts/auto-testing.md /tmp/claude-prompts/
cp .claude/prompts/security-rules.md /tmp/claude-prompts/
- name: Run Claude Code for Auto Testing
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ secrets.GH_TOKEN }}
allowed_non_write_users: '*'
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: |
--allowedTools "Bash,Read,Edit,Write,Glob,Grep"
--append-system-prompt "$(cat /tmp/claude-prompts/security-rules.md)"
prompt: |
Follow the auto testing guide located at:
```bash
cat /tmp/claude-prompts/auto-testing.md
```
## Task Assignment
${{ inputs.target_module && format('Process the specified module: {0}', inputs.target_module) || 'Automatically select one module from the target directories that needs test coverage' }}
## Environment Information
- Repository: ${{ github.repository }}
- Branch: ${{ github.ref_name }}
- Target Module: ${{ inputs.target_module || 'Auto-select' }}
- Run ID: ${{ github.run_id }}
**Start the auto testing process now.**