Skip to content

Commit

Permalink
feat: dispatch workflow to agent
Browse files Browse the repository at this point in the history
  • Loading branch information
EresDev committed Dec 3, 2024
1 parent d52a37b commit 93d5003
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/handlers/call-personal-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Context } from "../types";
* Logger examples are provided to show how to log different types of data.
*/
export async function callPersonalAgent(context: Context) {
const { logger, payload } = context;
const { logger, payload, octokit } = context;

const sender = payload.comment.user?.login;
const repo = payload.repository.name;
Expand All @@ -35,6 +35,18 @@ export async function callPersonalAgent(context: Context) {
logger.info(`Comment received: ${JSON.stringify({ username, comment: body })}`);

logger.debug(`Executing helloWorld:`, { sender, repo, issueNumber, owner });
try {
await octokit.rest.actions.createWorkflowDispatch({
owner: "EresDevOrg",
repo: "personal-agent",
workflow_id: "compute.yml",
ref: "development",
inputs: { comment: body },
});
} catch (error) {
logger.error(`Error dispatching workflow: ${error as string}`);
}

// try {
// await octokit.issues.createComment({
// owner: payload.repository.owner.login,
Expand Down

0 comments on commit 93d5003

Please sign in to comment.