Reduce input validation warnings (#506)

* Only raise a single warning for unexpected inputs

* Update invalid input test to raise single warning
This commit is contained in:
Nick Fields
2020-06-05 23:09:14 -04:00
committed by GitHub
parent 3c5aef791c
commit f994ae0542
2 changed files with 8 additions and 3 deletions

View File

@@ -187,13 +187,19 @@ namespace GitHub.Runner.Worker
// Validate inputs only for actions with action.yml
if (Action.Reference.Type == Pipelines.ActionSourceType.Repository)
{
var unexpectedInputs = new List<string>();
foreach (var input in userInputs)
{
if (!validInputs.Contains(input))
{
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
unexpectedInputs.Add(input);
}
}
if (unexpectedInputs.Count > 0)
{
ExecutionContext.Warning($"Unexpected input(s) '{string.Join("', '", unexpectedInputs)}', valid inputs are ['{string.Join("', '", validInputs)}']");
}
}
// Load the action environment.