Fix completion and validation issues in action.yml (#290)

Follow-up to https://github.com/actions/languageservices/pull/289

## What this fixes

**Autocomplete was broken inside composite action steps.** When you typed inside a step and triggered autocomplete, nothing showed up. Now you correctly get suggestions like run, uses, shell, etc.

**Duplicate error messages for missing required fields.** When a required field was missing (like main for Node.js actions), users saw two error messages - one generic schema validation error, and one custom error with a clear explanation. Now they only see the custom one.

For example, with using: node24 but no main:
- Before: Two errors shown
  - Schema: "There's not enough info to determine what you meant. Add one of these properties: args, entrypoint, image, main, ..."
  - Custom: "'main' is required for Node.js actions (using: node24)"
- After: Only the custom error is shown
This commit is contained in:
eric sciple
2026-01-07 08:42:59 -06:00
committed by GitHub
parent 2e46c66878
commit 78231482f5
4 changed files with 170 additions and 23 deletions
+6 -14
View File
@@ -658,23 +658,15 @@ function filterActionRunsCompletions(values: Value[], path: TemplateToken[], roo
return values;
}
// Also verify we're completing at the runs level, not deeper (like inside steps)
// The runs mapping should be the last mapping in the path before the completion position
// or the path should only have root -> runs
let lastMappingIndex = -1;
for (let i = path.length - 1; i >= 0; i--) {
if (path[i] instanceof MappingToken) {
lastMappingIndex = i;
break;
}
}
if (lastMappingIndex === -1) {
// Find where runsMapping is in the path
const runsMappingIndex = path.indexOf(runsMapping);
if (runsMappingIndex === -1) {
return values;
}
// If the last mapping in path is not the runs mapping, we're nested deeper (e.g., inside steps)
const lastMapping = path[lastMappingIndex];
if (lastMapping !== runsMapping) {
// Check if there's anything after runsMapping in the path
// If so, we're nested deeper (e.g., inside steps sequence or a step mapping)
if (runsMappingIndex < path.length - 1) {
return values;
}