โ๏ธ Configuration Options โ GitHub Action for Pull Requests
This page lists all configuration inputs and behavior for the Early-Catch GitHub Action on pull requests.
For shared concepts like tokens, memory, linting, concurrency, and SCM setup, see:
๐ Required Inputsโ
- JavaScript / TypeScript
- Python
| Name | Description | Required | Default |
|---|---|---|---|
| api-key | Early AI API key for backend access. | โ Yes | โ |
| token | GitHub token for repo access and commits. See token docs. | โ Yes | GITHUB_TOKEN |
| Variable | Description | Required | Default |
|---|---|---|---|
| API_KEY | Early AI API key for backend access. | โ Yes | โ |
| TOKEN | GitHub token for repo access and commits. See token docs. | โ Yes | โ |
| PR_NUMBER | Pull request number. | โ Yes | โ |
| REF_NAME | PR branch name. | โ Yes | โ |
Note: Python uses the Early CLI directly (not the GitHub Marketplace action), so environment variables are used instead of action
with:inputs.
โ๏ธ Optional Inputsโ
- JavaScript / TypeScript
- Python
| Name | Description | Default |
|---|---|---|
| test-structure | Where to place tests: siblingFolder or rootFolder | siblingFolder |
| test-framework | Target test framework (jest only for now) | jest |
| test-file-suffix | Suffix like test or spec | test |
| test-file-naming | camelCase, kebabCase, etc. | camelCase |
| max-concurrency | 1โ4 workers. See concurrency guide. | 1 |
| auto-commit | true/false โ whether to push files automatically | true |
| changed-methods-only | true/false โ Generate tests only for changed methods | false |
| coverage-command | Custom coverage command โ must keep Early flags | See Agent Jest Commands โ |
| test-command | Custom validation command โ must keep Early flags | See Agent Jest Commands โ |
| continue-on-test-errors | continue the operation if current tests fail. | See Agent Jest Commands - tests fail โ |
| lint-command | ESLint command before commit (see lint guide) | npx --no eslint $early_filename --fix |
| prettier-command | Prettier command before commit (see format guide) | npx --no prettier $early_filename --write |
| Variable | Description | Default |
|---|---|---|
| TEST_FRAMEWORK | Test framework. Auto-set to pytest for Python. | pytest |
| TEST_STRUCTURE | Folder structure: siblingFolder or rootFolder. | siblingFolder |
| TEST_FILE_NAMING | Naming style: camelCase or kebabCase. | camelCase |
| MAX_TESTABLES | Max number of methods to generate tests for. | 5 |
| MAX_CONCURRENCY | Parallel workers (1โ3). | 3 |
| AUTO_COMMIT | Commit and push generated test files: true or false. | true |
| AUTO_COMMIT_SKIP_CI | Append [skip ci] to the auto-commit message. | true |
| GIT_USER_EMAIL | Commit author email. | Early-Agent[bot] noreply address |
| GIT_USER_NAME | Commit author name. | early-agent[bot] |
| SCM_PROVIDER | github or bitbucket. | github |
Note: Options like
--test-command,--coverage-command,--lint-command, and--prettier-commandare not yet supported for Python.
๐ค Outputsโ
| Output Name | Description |
|---|---|
| pre-coverage | Coverage before test generation |
| post-coverage | Coverage after test generation |
Note: Coverage outputs are currently available for JavaScript/TypeScript projects only.
๐ง Memory Recommendationโ
- JavaScript / TypeScript
- Python
Set this in the env: section of your job:
NODE_OPTIONS: "--max-old-space-size=5120"
Required when using default concurrency (4). See Memory Tuning for limits per runner.
Python test generation does not require NODE_OPTIONS memory tuning. The py-agent manages its own memory usage.
๐ Placement: test-structureโ
- JavaScript / TypeScript
- Python
siblingFolderโ test files placed next to sourcerootFolderโ test files placed under a root/testsfolder
Test files are placed in .early.test/ sibling folders next to the source file:
src/
utils/
helpers.py
helpers.early.test/
test_my_function_early.py
๐งช Framework: test-frameworkโ
- JavaScript / TypeScript
- Python
Currently only jest is supported.
Support for mocha and vitest is planned.
The test framework is automatically set to pytest for Python projects. No configuration is needed.
๐งน Lint & Format Commandsโ
- JavaScript / TypeScript
- Python
If your repository enforces code style, prettier formatting, or pre-commit linting, you may need to configure test generation agents to run those tools automatically.
Early CLI agents have built-in defaults for linting and formatting:
lint-command: npx --no eslint $early_filename --fix
prettier-command: npx --no prettier $early_filename --write
These are the same commands described below. If your repository uses different commands (e.g., via hooks or custom scripts), you should override these defaults accordingly.
Lint and formatting hooks are not yet supported for Python projects. Generated test files follow standard pytest conventions.
๐ง Advanced Commandsโ
If customizing test or coverage commands, you must keep all required Early flags.
TBD
๐ Recommended Triggersโ
We recommend:
openedโ when PR is first createdready_for_reviewโ when draft is finalized
Avoid push or synchronize unless you want re-generation on every commit.
๐งฉ Example Configuration Blockโ
- JavaScript / TypeScript
- Python
with:
api-key: ${{ secrets.EARLY_SECRET_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
test-framework: jest
test-structure: rootFolder
test-file-suffix: spec
test-file-naming: kebabCase
auto-commit: true
lint-command: npx --no eslint $early_filename --fix
prettier-command: npx --no prettier $early_filename --write
env:
API_KEY: ${{ secrets.EARLY_API_KEY }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REF_NAME: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
TEST_FRAMEWORK: pytest
MAX_CONCURRENCY: "3"
AUTO_COMMIT: "true"
โ Best Practicesโ
- Keep
auto-commitenabled โ only valid files are pushed - Always define
NODE_OPTIONSfor JavaScript/TypeScript projects - Use
lint-commandandprettier-commandto prevent CI/pre-commit errors (JS/TS only) - Tune
max-concurrencyif hitting memory limits
๐ Next: Troubleshooting