Skip to content

Commit

Permalink
Update 0279-hashFiles-expression-function.md (actions#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref authored May 26, 2021
1 parent e0643c6 commit f21e280
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/adrs/0279-hashFiles-expression-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Status**: Accepted

## Context
First party action `actions/cache` needs a input which is an explicit `key` used for restoring and saving the cache. For packages caching, the most comment `key` might be the hash result of contents from all `package-lock.json` under `node_modules` folder.
First party action `actions/cache` needs a input which is an explicit `key` used for restoring and saving the cache. For packages caching, the most common `key` might be the hash result of contents from all `package-lock.json` under `node_modules` folder.

There are serval different ways to get the hash `key` input for `actions/cache` action.

Expand Down Expand Up @@ -38,7 +38,7 @@ There are serval different ways to get the hash `key` input for `actions/cache`
`hashFiles()` will only support hashing files under the `$GITHUB_WORKSPACE` since the expression evaluated on the runner, if customer use job container or container action, the runner won't have access to file system inside the container.

`hashFiles()` will only take 1 parameters:
- `hashFiles('**/package-lock.json')` // Search files under $GITHUB_WORKSPACE and calculate a hash for them
- `hashFiles('**/package-lock.json')` // Search files under `$GITHUB_WORKSPACE` and calculate a hash for them

**Question: Do we need to support more than one match patterns?**
Ex: `hashFiles('**/package-lock.json', '!toolkit/core/package-lock.json', '!toolkit/io/package-lock.json')`
Expand All @@ -52,7 +52,7 @@ This will help customer has better experience with the `actions/cache` action's
key: ${{hashFiles('**/package-lock.json')}}-${{github.ref}}-${{runner.os}}
```

For search pattern, we will use basic globbing (`*` `?` and `[]`) and globstar (`**`).
For search pattern, we will use basic globbing (`*`, `?`, and `[]`) and globstar (`**`).

Additional pattern details:
- Root relative paths with `github.workspace` (the main repo)
Expand All @@ -68,4 +68,4 @@ Hashing logic:
5. Use SHA256 to hash all stored files' hash results to get the final 64 chars hash result.

**Question: Should we include the folder structure info into the hash?**
Answer: No
Answer: No

0 comments on commit f21e280

Please sign in to comment.