This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-skills/skills/github-action-gen/src/index.ts
T

22 lines
767 B
TypeScript

import OpenAI from "openai";
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
export async function generateWorkflow(description: string): Promise<string> {
const res = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{
role: "system",
content: "You are a DevOps expert. Generate a complete GitHub Actions workflow YAML file based on the description. Use best practices: proper triggers, caching, environment variables, and job dependencies. Return ONLY the YAML content, no explanation.",
},
{
role: "user",
content: `Create a GitHub Actions workflow: ${description}`,
},
],
temperature: 0.3,
});
return res.choices[0].message.content || "";
}