docs(action): add missing input defaults and fix cache-hit description#1762
Open
kranthipoturaju wants to merge 1 commit into
Open
docs(action): add missing input defaults and fix cache-hit description#1762kranthipoturaju wants to merge 1 commit into
kranthipoturaju wants to merge 1 commit into
Conversation
- 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>
Contributor
There was a problem hiding this comment.
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 therestore-keysinput. - Expand the
cache-hitoutput description to better describe exact/partial matches and unset behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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." |
| 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." |
| 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: '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documentation-only corrections to
action.yml: two optional inputs now carry explicitdefaultvalues, and thecache-hitoutput description is replaced with a precise account of its three observable states.Changes
inputs.restore-keys— addeddefault: ''; the implementation'sgetInputAsArrayreturns an empty list when the input is absent, so''accurately reflects the runtime behaviourinputs.upload-chunk-size— addeddefault: '';getInputAsIntreturnsundefinedon empty input, passinguploadChunkSize: undefinedtocache.saveCacheand deferring to the@actions/cachelibrary's own chunk-sizedefault
outputs.cache-hitdescription — 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 unavailableDescription
Motivation and Context
restore-keysandupload-chunk-sizewere the only two optional inputs without adefaultproperty, 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.cache-hitdescription 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 testcache-hit == 'false'to detect a miss — documenting it inline makes it visible without requiring users to read source code or issue history.Impact
default: ''to string inputs does not change what the action receives when the input is omitted by a caller.action.ymlmetadata will now surface accurate information.How Has This Been Tested?
restore-keyshandling againstgetInputAsArrayinsrc/utils/actionUtils.ts(splits on newlines, filters empty strings →[]when input is absent).upload-chunk-sizehandling againstgetInputAsIntinsrc/utils/actionUtils.ts(parseInt('')→NaN→ returnsundefined).cache-hitstates againstrestoreImpl.ts:core.setOutput(Outputs.CacheHit, "false")on unavailable service, nosetOutputcall inside the!cacheKeybranch (comment references Cache-Hit set to string, not boolean, as of v4.1.0 #1466), andcore.setOutput(Outputs.CacheHit, isExactKeyMatch.toString())on successful restore.Screenshots (if appropriate): NA
Types of changes
Checklist: