Skip to content

How to concatenate strings inside hashFiles #25718

Answered by bcowdery
tomgrossman asked this question in Actions
Discussion options

You must be logged in to vote

We do something similar for caching our C# nuget packages. Since we use a mono-repo we need the hashFiles key to be based off the project sub-directory. You can use the format helper to build the path strings - Try hashFiles(format('{0}/**', matrix.apps.path)).

Here’s our cache action for reference.

    - name: Cache NuGet packages
      uses: actions/cache@v2
      with:
        path: ~/.nuget/packages
        key: ${{ runner.os }}-nuget-${{ hashFiles(format('{0}/**/*.csproj', env.PROJECT_DIR), format('{0}/*.props', env.PROJECT_DIR)) }}
        restore-keys: ${{ runner.os }}-nuget

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback
2 participants