Skip to content
Merged
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
4 changes: 4 additions & 0 deletions actions/setup/js/action_input_utils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
* some runner versions preserve the original hyphen from the input name. Checking
* both forms ensures the value is resolved regardless of the runner version.
*
* The underscore form has precedence: if `INPUT_<NAME>` exists (even as whitespace),
* it is used. The hyphen form is only checked if the underscore form is absent or
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/grill-with-docs] Documentation inaccuracy: whitespace-only values do NOT fall back to hyphen form.

❌ The issue

The new documentation states:

The underscore form has precedence: if INPUT_<NAME> exists (even as whitespace), it is used. The hyphen form is only checked if the underscore form is absent or empty string.

This contradicts the actual behavior. Whitespace-only values are truthy, so the || operator short-circuits and never checks the hyphen form. The test suite explicitly documents this:

it("does not fall back to hyphen form when underscore form is whitespace-only (whitespace is truthy)", () => {
  vi.stubEnv("INPUT_JOB_NAME", "   ");
  vi.stubEnv("INPUT_JOB-NAME", "real-value");
  expect(getActionInput("JOB_NAME")).toBe("");  // Returns "", not "real-value"
});
✅ Suggested fix

Replace lines 12–14 with:

 * The underscore form has precedence: if `INPUT_<NAME>` is truthy (including
 * whitespace-only strings), it is used and the result is trimmed. The hyphen form
 * is only checked if the underscore form is absent (undefined) or empty string ("").

Or, to match the test name more precisely:

 * Precedence: The underscore form (`INPUT_<NAME>`) is checked first using the `||`
 * operator. If it is truthy (even whitespace like `"   "`), it is used and trimmed.
 * The hyphen form is only checked if the underscore form is falsy (undefined, null, or "").

* empty string.
*
* @param {string} name - Input name in UPPER_UNDERSCORE form (e.g. "JOB_NAME")
* @returns {string} Trimmed input value, or "" if not set.
*/
Expand Down
Loading