hashFiles() with multiple patterns

I’d like to use hashFiles() with multiple paths. For example, in a Scala SBT project, build files cannot be matched by a single pattern. The following two patterns are needed:

  hashFiles("**/project/**", “**/build.sbt”)

Is this supported by hashFiles() function?

1 Like

I am sorry to tell you that it is not supported to specify multiple patterns in hashFiles() function. It only supports a single path .

When use two paths, we will get error Too many parameters supplied .

It’s a bit of a hassle, but for the time being one has to use

key: ${{ hashFiles(" **/project/**") }}-${{ hashFiles("**/build.sbt") }}

I publish a action for multiple folders hash, you can see it here


It’s now possible to use multiple files in hashFiles using exactly the syntax in the initial post.