How does `hashFiles` work and where can it be used?
IntermediateConceptContexts, Expressions, Env & Outputs
Answer
hashFiles('**/package-lock.json') returns a SHA-256 hash of all matching files under GITHUB_WORKSPACE (sorted, then combined), or an empty string if nothing matches. Multiple patterns and negation are allowed: hashFiles('**/go.sum', '!vendor/**'). It is evaluated on the runner, so it works in step-level keys like a cache key, not in job-level if or runs-on. It must finish within a time limit, so avoid patterns that scan node_modules in a huge workspace.
More on Contexts, Expressions, Env & Outputs
List the available contexts and what each holds.BeginnerWhich contexts can you use in which keys? Give two examples that trip people up.AdvancedWhat are the expression operators and how do comparisons coerce types?IntermediateHow do you write a ternary in GitHub Actions expressions?IntermediateWhat do `contains`, `startsWith`, `endsWith`, `format` and `join` do?BeginnerWhat are object filters (`.*`) and how are they useful?Intermediate