-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
49 lines (43 loc) · 1.08 KB
/
index.ts
File metadata and controls
49 lines (43 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
import * as core from "@actions/core";
import { Octokit } from "@octokit/rest";
import { runAuggie } from "./auggie";
import {
getAuggieParams,
parseRepository,
reactToComment,
} from "./utils";
/**
* Main function
*/
async function main(): Promise<void> {
const {
eventName,
prompt,
augmentApiKey,
augmentApiUrl,
workspaceRoot,
commentBody,
commentId,
} = getAuggieParams();
const { owner, repo } = parseRepository();
const githubToken = process.env.GITHUB_TOKEN;
const octokit = new Octokit({ auth: githubToken });
await reactToComment({ octokit, owner, repo, eventName });
core.info("Running Auggie agent...");
await runAuggie({
userPrompt: prompt,
apiKey: augmentApiKey,
apiUrl: augmentApiUrl,
workspaceRoot: workspaceRoot || undefined,
commentBody,
commentId,
});
core.info("✅ Auggie agent completed successfully");
core.setOutput("success", "true");
}
// Run the action
main().catch((error) => {
const errorMessage = error instanceof Error ? error.message : String(error);
core.setFailed(`Unexpected error: ${errorMessage}`);
});