Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-dispatcher.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 32 additions & 2 deletions actions/setup/js/qmd_index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,20 @@ async function main() {
const collections = {};

for (const checkout of config.checkouts || []) {
const resolvedPath = resolveEnvVars(checkout.path);
const pattern = (checkout.patterns || ["**/*.md"]).join(",");
const rawPath = checkout.path;
const resolvedPath = resolveEnvVars(rawPath);
const patterns = checkout.patterns || ["**/*.md"];
const pattern = patterns.join(",");

core.info(`Collection "${checkout.name}": path="${rawPath}" -> "${resolvedPath}" pattern="${pattern}"`);

const pathExists = fs.existsSync(resolvedPath);
if (!pathExists) {
core.warning(`Collection "${checkout.name}": path "${resolvedPath}" does not exist — no files will be indexed`);
} else {
core.info(`Collection "${checkout.name}": path exists`);
}

collections[checkout.name] = {
path: resolvedPath,
pattern,
Expand Down Expand Up @@ -230,6 +242,12 @@ async function main() {
}

// ── Create store and build index ─────────────────────────────────────────
const collectionNames = Object.keys(collections);
core.info(`Registering ${collectionNames.length} collection(s): ${collectionNames.join(", ")}`);
for (const [name, col] of Object.entries(collections)) {
core.info(` [${name}] path="${col.path}" pattern="${col.pattern || "(default)"}"`);
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The collection summary log uses col.pattern || "(default)", which will report "(default)" when col.pattern is the empty string (e.g., when checkout.patterns is an empty array and patterns.join(",") yields ""). That’s misleading for debugging and hides an actual misconfiguration (an empty pattern typically matches nothing). Consider logging the actual value (even if empty) and/or normalizing empty patterns back to the default (e.g., treat [] or "" as "**/*.md").

Suggested change
core.info(` [${name}] path="${col.path}" pattern="${col.pattern || "(default)"}"`);
const patternForLog = col.pattern === undefined ? "(default)" : col.pattern;
core.info(` [${name}] path="${col.path}" pattern="${patternForLog}"`);

Copilot uses AI. Check for mistakes.
}

core.info(`Creating qmd store at ${dbPath}…`);

const store = await createStore({ dbPath, config: { collections } });
Expand All @@ -248,6 +266,18 @@ async function main() {
});
core.info(`Update complete: ${updateResult.indexed} indexed, ${updateResult.updated} updated, ` + `${updateResult.unchanged} unchanged, ${updateResult.removed} removed`);

const totalFiles = updateResult.indexed + updateResult.updated + updateResult.unchanged;
if (totalFiles === 0) {
core.warning(
"No files were indexed. Possible causes:\n" +
" - The checkout path does not exist or was not checked out\n" +
" - The glob patterns do not match any files (check for dotfile exclusions in patterns starting with '.')\n" +
" - The pattern uses a comma-separated list that the qmd SDK does not support\n" +
" - The checkout path resolves to an empty string (check ${ENV_VAR} placeholders in 'path')\n" +
"Review the collection log lines above for the resolved path and pattern."
);
}

core.info("Generating embeddings (embed)…");
embedResult = await store.embed({
onProgress: (/** @type {{ current: number, total: number }} */ info) => {
Expand Down
Loading