Skip to content

Commit df88713

Browse files
authored
Support model (#1)
* Support model * Format * Update example
1 parent 6f08f56 commit df88713

File tree

6 files changed

+29
-19
lines changed

6 files changed

+29
-19
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,20 @@ Each example includes a complete workflow file that you can copy to your `.githu
6666

6767
### Inputs
6868

69-
| Input | Description | Required | Example |
70-
| ---------------------- | ----------------------------------------------------- | -------- | ----------------------------------------- |
71-
| `augment_session_auth` | Augment session authentication JSON (store as secret) | No\*\* | `${{ secrets.AUGMENT_SESSION_AUTH }}` |
72-
| `augment_api_token` | API token for Augment services (store as secret) | No\*\* | `${{ secrets.AUGMENT_API_TOKEN }}` |
73-
| `augment_api_url` | Augment API endpoint URL (store as variable) | No\*\* | `${{ vars.AUGMENT_API_URL }}` |
74-
| `github_token` | GitHub token with `repo` and `user:email` scopes. | No | `${{ secrets.GITHUB_TOKEN }}` |
75-
| `instruction` | Direct instruction text for simple commands | No\* | `"Generate PR description"` |
76-
| `instruction_file` | Path to file with detailed instructions | No\* | `/tmp/instruction.txt` |
77-
| `template_directory` | Path to template directory for dynamic instructions | No\* | `.github/templates` |
78-
| `template_name` | Template file name (default: prompt.njk) | No | `pr-review.njk` |
79-
| `pull_number` | PR number for template context extraction | No | `${{ github.event.pull_request.number }}` |
80-
| `repo_name` | Repository name for template context | No | `${{ github.repository }}` |
81-
| `custom_context` | Additional JSON context for templates | No | `'{"priority": "high"}'` |
69+
| Input | Description | Required | Example |
70+
| ---------------------- | ----------------------------------------------------- | -------- | ------------------------------------------- |
71+
| `augment_session_auth` | Augment session authentication JSON (store as secret) | No\*\* | `${{ secrets.AUGMENT_SESSION_AUTH }}` |
72+
| `augment_api_token` | API token for Augment services (store as secret) | No\*\* | `${{ secrets.AUGMENT_API_TOKEN }}` |
73+
| `augment_api_url` | Augment API endpoint URL (store as variable) | No\*\* | `${{ vars.AUGMENT_API_URL }}` |
74+
| `github_token` | GitHub token with `repo` and `user:email` scopes. | No | `${{ secrets.GITHUB_TOKEN }}` |
75+
| `instruction` | Direct instruction text for simple commands | No\* | `"Generate PR description"` |
76+
| `instruction_file` | Path to file with detailed instructions | No\* | `/tmp/instruction.txt` |
77+
| `template_directory` | Path to template directory for dynamic instructions | No\* | `.github/templates` |
78+
| `template_name` | Template file name (default: prompt.njk) | No | `pr-review.njk` |
79+
| `pull_number` | PR number for template context extraction | No | `${{ github.event.pull_request.number }}` |
80+
| `repo_name` | Repository name for template context | No | `${{ github.repository }}` |
81+
| `custom_context` | Additional JSON context for templates | No | `'{"priority": "high"}'` |
82+
| `model` | Model to use; passed through to auggie as --model | No | e.g. `sonnet4`, from `auggie --list-models` |
8283

8384
\*Either `instruction`, `instruction_file`, or `template_directory` must be provided.
8485

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ inputs:
3737
custom_context:
3838
description: "Additional context data as JSON string to pass to templates."
3939
required: false
40+
model:
41+
description: "Model to use; forwarded to auggie as --model"
42+
required: false
4043

4144
runs:
4245
using: "composite"
@@ -67,3 +70,4 @@ runs:
6770
INPUT_PULL_NUMBER: ${{ inputs.pull_number }}
6871
INPUT_REPO_NAME: ${{ inputs.repo_name }}
6972
INPUT_CUSTOM_CONTEXT: ${{ inputs.custom_context }}
73+
INPUT_MODEL: ${{ inputs.model }}

src/config/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const INPUT_FIELD_MAP: Record<string, InputField> = {
2424
repoName: { envVar: 'INPUT_REPO_NAME', required: false },
2525
templateDirectory: { envVar: 'INPUT_TEMPLATE_DIRECTORY', required: false },
2626
templateName: { envVar: 'INPUT_TEMPLATE_NAME', required: false },
27+
model: { envVar: 'INPUT_MODEL', required: false },
2728
};
2829

2930
export const TEMPLATE_CONFIG = {

src/index.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,19 @@ async function runAugmentScript(inputs: ActionInputs): Promise<void> {
113113
instructionFile: instruction_value,
114114
});
115115
}
116+
const args = ['--print'];
117+
if (inputs.model && inputs.model.trim().length > 0) {
118+
args.push('--model', inputs.model.trim());
119+
}
116120
if (is_file) {
117121
logger.info(`📄 Using instruction file: ${instruction_value}`);
118-
await execCommand('auggie', [
119-
'--instruction-file',
120-
instruction_value,
121-
'--print',
122-
]);
122+
args.push('--instruction-file');
123123
} else {
124124
logger.info('📝 Using direct instruction');
125-
await execCommand('auggie', ['--print', instruction_value]);
125+
args.push('--instruction');
126126
}
127+
args.push(instruction_value);
128+
await execCommand('auggie', args);
127129
logger.info('✅ Augment Agent completed successfully');
128130
}
129131

src/types/inputs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface ActionInputs {
1616
githubToken?: string | undefined;
1717
instruction?: string | undefined;
1818
instructionFile?: string | undefined;
19+
model?: string | undefined;
1920

2021
// Template inputs
2122
templateDirectory?: string | undefined;

src/utils/validation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const ActionInputsSchema = z
1818
githubToken: z.string().optional(),
1919
instruction: z.string().optional(),
2020
instructionFile: z.string().optional(),
21+
model: z.string().optional(),
2122
templateDirectory: z.string().optional(),
2223
templateName: z.string().default('prompt.njk'),
2324
customContext: z.string().optional(),

0 commit comments

Comments
 (0)