Do not report required inputs without value but a default as error
This commit is contained in:
@@ -65,7 +65,7 @@ export async function validateAction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const missingRequiredInputs = Object.entries(actionInputs).filter(
|
const missingRequiredInputs = Object.entries(actionInputs).filter(
|
||||||
([inputName, input]) => input.required && !stepInputs.has(inputName)
|
([inputName, input]) => input.required && !stepInputs.has(inputName) && input.default === undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
if (missingRequiredInputs.length > 0) {
|
if (missingRequiredInputs.length > 0) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Diagnostic, DiagnosticSeverity} from "vscode-languageserver-types";
|
import {DiagnosticSeverity} from "vscode-languageserver-types";
|
||||||
import {ActionInput, ActionReference} from "./action";
|
import {ActionInput, ActionReference} from "./action";
|
||||||
import {registerLogger} from "./log";
|
import {registerLogger} from "./log";
|
||||||
import {createDocument} from "./test-utils/document";
|
import {createDocument} from "./test-utils/document";
|
||||||
@@ -29,6 +29,15 @@ const validationConfig: ValidationConfig = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case "actions/deploy-pages":
|
||||||
|
inputs = {
|
||||||
|
token: {
|
||||||
|
required: true,
|
||||||
|
description: "token to use",
|
||||||
|
default: "${{ github.token }}"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
case "actions/cache@v1":
|
case "actions/cache@v1":
|
||||||
inputs = {
|
inputs = {
|
||||||
path: {
|
path: {
|
||||||
@@ -157,6 +166,20 @@ jobs:
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("required input with default value", async () => {
|
||||||
|
const input = `
|
||||||
|
on: push
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/deploy-pages@main
|
||||||
|
`;
|
||||||
|
const result = await validate(createDocument("wf.yaml", input), validationConfig);
|
||||||
|
|
||||||
|
expect(result).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
it("multiple missing required inputs", async () => {
|
it("multiple missing required inputs", async () => {
|
||||||
const input = `
|
const input = `
|
||||||
on: push
|
on: push
|
||||||
|
|||||||
Reference in New Issue
Block a user