Repository navigation
Correct hashFiles explanation and example cache key - #47078
aniruddhaadak80 wants to merge 1 commit into
Conversation
|
Warning This pull request was closed automatically. Please don't raise pull requests against an existing issue that another user has raised until it's been marked with a |
How to review these changes 👓Thank you for your contribution. To review these changes, choose one of the following options: A Hubber will need to deploy your changes internally to review. Table of review linksNote: Please update the URL for your staging server or codespace. The table shows the files in the
Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server 🤖 This comment is automatically generated. |
There was a problem hiding this comment.
🟡 Changes recommended
The documentation correction remains incomplete because related examples still present abbreviated hashes as resolved values, leaving the article internally inconsistent.
1 open issue
What changed in this PR
This PR corrects the dependency-caching documentation so that hashFiles() is accurately described and the example cache key uses a full SHA-256 hash.
Changes:
- Replaces the incorrect reference to a nonexistent
hashexpression. - Clarifies that the cache key contains a full SHA-256 hash.
- Replaces the abbreviated example with a 64-character hash placeholder.
| File | Description |
|---|---|
| content/actions/reference/workflows-and-actions/dependency-caching.md | Updates the hashFiles() explanation and example cache key. |
Review effort: Lite
| {% endraw %} | ||
|
|
||
| {% data variables.product.prodname_dotcom %} evaluates the expression `hash "package-lock.json"` to derive the final `key`. | ||
| {% data variables.product.prodname_dotcom %} evaluates the expression to derive the final `key`. The `hashFiles()` function returns a SHA-256 hash of the file's contents, so the resulting key contains the full hash. For example: |

Why:
Closes: #46499
What's being changed (if available, include any code snippets, screenshots, or gifs):
The dependency caching article described the cache key example as evaluating the expression
hash "package-lock.json"and showed the abbreviated example keynpm-d5ea0750. Neither is accurate: there is nohashexpression, andhashFiles()returns a full SHA-256 hash. The paragraph now nameshashFiles(), states that the key contains the full hash, and uses a placeholder (npm-<64-character SHA-256 hash>) instead of the misleading short value.Verification
npm ci --prefer-offline --no-audit --no-fundin the isolated worktree: succeeded (added 1044 packages), withEBADENGINEwarnings because this machine has Node v22.23.2 while the repository requires Node^26.npm run lint-content -- --paths content/actions/reference/workflows-and-actions/dependency-caching.md: failed under Node v22 withTypeError: RegExp.escape is not a function.npx -y node@26 ./node_modules/tsx/dist/cli.mjs src/content-linter/scripts/lint-content.ts --paths content/actions/reference/workflows-and-actions/dependency-caching.md→Markdownlint finished in 122.6 s/No errors found.hashFiles()againstcontent/actions/reference/workflows-and-actions/expressions.md, which documents a final SHA-256 hash.Limitations
git pushto the fork failed with HTTP 408 because the fork'smainis 1161 commits behindupstream/main, so the branch and its single-file commit were created directly on the fork with the GitHub REST API. The content is identical to the local commit.AI assistance disclosure
This change and PR body were prepared with AI assistance. The issue, the existing
hashFiles()documentation, and local validation results were checked before submission.Check off the following: