Skip to content

Commit 7a023b1

Browse files
committed
debug workflow dispatch for dax
1 parent 18fb57b commit 7a023b1

1 file changed

Lines changed: 29 additions & 14 deletions

File tree

scripts/build-workflow-matrix.ts

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import { readFileSync } from "node:fs";
1919
import YAML from "yaml";
20-
import { listAgents } from "~/agents/index.js";
2120

2221
interface WorkflowInputs {
2322
[key: string]: string | boolean;
@@ -33,22 +32,38 @@ interface DatasetEntry {
3332
repo: string;
3433
}
3534

36-
// Convert agent:model to workflow input ID
37-
function toInputId(agent: string, model: string): string {
38-
return `${agent}_${model}`
39-
.replace(/\//g, "_")
40-
.replace(/-/g, "_");
35+
interface WorkflowInputDefinition {
36+
description: string;
37+
type: string;
38+
default: boolean;
4139
}
4240

43-
// Build mapping from input IDs to agent:model combinations
44-
async function buildInputMapping(): Promise<Map<string, { agent: string; model: string }>> {
45-
const agents = await listAgents();
41+
// Build mapping from input IDs to agent:model combinations by reading workflow file
42+
function buildInputMapping(): Map<string, { agent: string; model: string }> {
43+
const workflowPath = new URL(
44+
"../.github/workflows/compare-models.yml",
45+
import.meta.url,
46+
);
47+
const workflowContent = readFileSync(workflowPath, "utf8");
48+
const workflow = YAML.parse(workflowContent);
49+
50+
const inputs = workflow?.on?.workflow_dispatch?.inputs as Record<
51+
string,
52+
WorkflowInputDefinition
53+
>;
54+
if (!inputs) {
55+
throw new Error("No workflow_dispatch inputs found in workflow file");
56+
}
57+
4658
const mapping = new Map<string, { agent: string; model: string }>();
4759

48-
for (const agent of agents) {
49-
for (const model of agent.models) {
50-
const inputId = toInputId(agent.name, model);
51-
mapping.set(inputId, { agent: agent.name, model });
60+
for (const [inputId, inputDef] of Object.entries(inputs)) {
61+
// Parse description which is in format "agent:model"
62+
const description = inputDef.description;
63+
const parts = description.split(":");
64+
if (parts.length === 2) {
65+
const [agent, model] = parts;
66+
mapping.set(inputId, { agent, model });
5267
}
5368
}
5469

@@ -79,7 +94,7 @@ async function main(): Promise<void> {
7994
const dataset = loadDataset();
8095

8196
// Build input ID to agent:model mapping dynamically
82-
const inputMapping = await buildInputMapping();
97+
const inputMapping = buildInputMapping();
8398

8499
// Collect selected agent:model combinations
85100
const selectedCombinations: Array<{ agent: string; model: string }> = [];

0 commit comments

Comments
 (0)