Skip to content

Commit 62f16db

Browse files
committed
update
1 parent 95e6f9c commit 62f16db

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This action triggers CodeBeaver to generate unit tests for your pull requests au
88
- Uses CodeBeaver's AI-powered analysis to create relevant tests
99
- Supports all languages and frameworks that CodeBeaver supports
1010
- Integrates seamlessly with GitHub's pull request workflow
11+
- Configurable action types for different CodeBeaver operations
1112

1213
## Usage
1314

@@ -35,17 +36,33 @@ jobs:
3536
- uses: codebeaver-ai/[email protected]
3637
with:
3738
api-key: ${{ secrets.CODEBEAVER_API_KEY }}
39+
action-type: "analyze-and-generate"
3840
env:
3941
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4042
```
4143
4244
## Inputs
4345
44-
| Input | Description | Required | Default |
45-
| ------------ | ------------------------------- | -------- | ------------------ |
46-
| `api-key` | CodeBeaver API Key | Yes | N/A |
47-
| `repository` | Repository in owner/repo format | No | Current repository |
48-
| `pr-number` | Pull request number | No | Current PR number |
46+
| Input | Description | Required | Default |
47+
| ------------- | ------------------------------- | -------- | ------------------ |
48+
| `api-key` | CodeBeaver API Key | Yes | N/A |
49+
| `action-type` | Type of action to perform | Yes | N/A |
50+
| `repository` | Repository in owner/repo format | No | Current repository |
51+
| `pr-number` | Pull request number | No | Current PR number |
52+
53+
### Action Types
54+
55+
The `action-type` parameter determines what operation CodeBeaver will perform:
56+
57+
- `analyze` - Analyzes your changes and provides tests results and bug detection analysis as a PR comment
58+
- `analyze-and-generate` - Does everything `analyze` does, plus generates test files and creates a new PR with the changes
59+
- `dry-run` - Performs analysis and shows what would be generated without making any changes
60+
61+
Each action type provides different levels of automation:
62+
63+
- Use `analyze` when you want CodeBeaver to run existing tests and provide results as a PR comment
64+
- Use `analyze-and-generate` when you want CodeBeaver to run existing tests, generate new tests, and propose them via a new PR
65+
- Use `dry-run` during initial setup or to preview CodeBeaver's analysis
4966

5067
## Example with all options
5168

@@ -55,6 +72,7 @@ jobs:
5572
api-key: ${{ secrets.CODEBEAVER_API_KEY }}
5673
repository: "octocat/Hello-World"
5774
pr-number: "123"
75+
action-type: "analyze-and-generate"
5876
env:
5977
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6078
```

dist/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32599,6 +32599,7 @@ async function run() {
3259932599
const apiKey = core.getInput('api-key', { required: true });
3260032600
const repository = core.getInput('repository');
3260132601
const prNumber = core.getInput('pr-number');
32602+
const actionType = core.getInput('action-type', { required: true });
3260232603
// Parse repository owner and name
3260332604
const [owner, repo] = repository.split('/');
3260432605
// Initialize Octokit
@@ -32618,6 +32619,7 @@ async function run() {
3261832619
body: JSON.stringify({
3261932620
type: 'pull_request',
3262032621
git_provider_service: 'github',
32622+
action: actionType,
3262132623
git_provider_id: repoData.id.toString(),
3262232624
pr_number: prNumber
3262332625
})

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ async function run(): Promise<void> {
77
const apiKey = core.getInput('api-key', { required: true });
88
const repository = core.getInput('repository');
99
const prNumber = core.getInput('pr-number');
10+
const actionType = core.getInput('action-type', { required: true });
1011

1112
// Parse repository owner and name
1213
const [owner, repo] = repository.split('/');
@@ -30,6 +31,7 @@ async function run(): Promise<void> {
3031
body: JSON.stringify({
3132
type: 'pull_request',
3233
git_provider_service: 'github',
34+
action: actionType,
3335
git_provider_id: repoData.id.toString(),
3436
pr_number: prNumber
3537
})

0 commit comments

Comments
 (0)