A line ending invariant alternative to hashFiles
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
Description
Describe the enhancement
Sometimes cached data is sufficiently cross-platform to be reused across runners on Windows and the Unix OSes. A problem arises if the cache key needs to be computed by hash-summing text files, which produces differing hash sums on the same file if it was e.g. checked out by git in text mode applying auto-conversion to the line endings.
This workflow run failed to hit the cache in the Windows test job, even though the preceding update-deps job on Linux had stored it.
Code Snippet
It would be nice if a hashTextFiles function was available that would canonicalize line endings for the hash input:
test:
needs: update-deps
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- id: cargo-registry
name: Restore cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashTextFiles('**/Cargo.lock') }}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue points to a proposed hashTextFiles expression in the workflow example, with Cargo.lock as the input, and references actions/checkout@v2 and actions/cache@v1. Start by tracing the existing hashFiles behavior; done means equivalent text files produce the same cache key across the Linux, Windows, and macOS jobs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git, github-actions, yaml
- Domain
- ci-cd
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100