Skip to content

docs(action): add missing input defaults and fix cache-hit description#1762

Open
kranthipoturaju wants to merge 1 commit into
actions:mainfrom
kranthipoturaju:docs/fix-action-yml-accuracy
Open

docs(action): add missing input defaults and fix cache-hit description#1762
kranthipoturaju wants to merge 1 commit into
actions:mainfrom
kranthipoturaju:docs/fix-action-yml-accuracy

Conversation

@kranthipoturaju
Copy link
Copy Markdown

Summary

Documentation-only corrections to action.yml: two optional inputs now carry explicit default values, and the cache-hit output description is replaced with a precise account of its three observable states.

Changes

  • inputs.restore-keys — added default: ''; the implementation's getInputAsArray returns an empty list when the input is absent, so '' accurately reflects the runtime behaviour
  • inputs.upload-chunk-size — added default: ''; getInputAsInt returns undefined on empty input, passing uploadChunkSize: undefined to cache.saveCache and deferring to the @actions/cache library's own chunk-size
    default
  • outputs.cache-hit description — expanded from a vague one-liner to document all states:
    • 'true' — exact primary key match
    • 'false' — partial match via a restore-key, or cache service unavailable
    • not emitted — when no cache entry is found at all (intentional behaviour preserved from #1466)

Description

Motivation and Context

  • restore-keys and upload-chunk-size were the only two optional inputs without a default property, creating an inconsistency across the file and leaving tooling (IDE YAML hints, schema validators) unable to show callers what happens when the input is omitted.
  • The original cache-hit description implied the output is always a boolean, which is incorrect. The "not set on cache miss" edge case is a known quirk that causes subtle bugs when downstream steps test cache-hit == 'false' to detect a miss — documenting it inline makes it visible without requiring users to read source code or issue history.

Impact

  • No behaviour change — all three modifications are documentation only; no runtime logic is touched.
  • Backward compatible — adding default: '' to string inputs does not change what the action receives when the input is omitted by a caller.
  • IDE tooltips, auto-generated docs, and YAML schema tooling that reads action.yml metadata will now surface accurate information.

How Has This Been Tested?

  • Verified restore-keys handling against getInputAsArray in src/utils/actionUtils.ts (splits on newlines, filters empty strings → [] when input is absent).
  • Verified upload-chunk-size handling against getInputAsInt in src/utils/actionUtils.ts (parseInt('')NaN → returns undefined).
  • Verified cache-hit states against restoreImpl.ts: core.setOutput(Outputs.CacheHit, "false") on unavailable service, no setOutput call inside the !cacheKey branch (comment references Cache-Hit set to string, not boolean, as of v4.1.0 #1466), and core.setOutput(Outputs.CacheHit, isExactKeyMatch.toString()) on successful restore.
  • No functional code changed; no test run required.

Screenshots (if appropriate): NA

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (add or update README or docs)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

 - Add  to  and  inputs, making the absence-of-value behaviour explicit and consistent with all other optional inputs in the file.
 - Expand the  output description to document all three observable states: 'true' on exact key match, 'false' on partial restore-key match or unavailable cache service, and not set when no cache entry is found (intentional; see actions#1466).

Co-authored-by: Kranthi Poturaju <152148+kranthipoturaju@users.noreply.github.com>

Co-authored-by: Panuganti Saketh <sakethpanuganti@gmail.com>
Copilot AI review requested due to automatic review settings May 25, 2026 13:47
@kranthipoturaju kranthipoturaju requested a review from a team as a code owner May 25, 2026 13:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the GitHub Action metadata to clarify cache-hit semantics and add an explicit default for restore-keys.

Changes:

  • Add default: '' for the restore-keys input.
  • Expand the cache-hit output description to better describe exact/partial matches and unset behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread action.yml
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
description: "A boolean value to indicate an exact match was found for the primary key. Returns 'true' on exact key match, 'false' on partial match via restore-keys or when the cache service is unavailable. Not set when no cache entry is found."
Comment thread action.yml
outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
description: "A boolean value to indicate an exact match was found for the primary key. Returns 'true' on exact key match, 'false' on partial match via restore-keys or when the cache service is unavailable. Not set when no cache entry is found."
Comment thread action.yml
restore-keys:
description: 'An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.'
required: false
default: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants