https://github.com/techservicesillinois/cache-validation
A Github action for validating cache objects
https://github.com/techservicesillinois/cache-validation
Last synced: 2 months ago
JSON representation
A Github action for validating cache objects
- Host: GitHub
- URL: https://github.com/techservicesillinois/cache-validation
- Owner: techservicesillinois
- License: other
- Created: 2021-03-23T18:50:02.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-18T14:34:28.000Z (about 1 year ago)
- Last Synced: 2026-02-17T17:44:07.294Z (4 months ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# cache-validation
This action allows cache objects to be validated using MD5 checksums.
[](https://github.com/techservicesillinois/cache-validation/actions/workflows/tests.yml)
This action is supported by the Cybersecurity Development team at
the University of Illinois, on a best-effort basis. As of the last
update to this README, the expected End-of-Life and End-of-Support
date of this version is April 2026, the same as its sole
dependency
[Node.js 20](https://nodejs.org/en/about/releases/).
## Usage
This action is designed to be used with the [cache
action](https://github.com/actions/cache/blob/main/README.md) to
provide validation. Below is a simple example:
```yaml
- name: Cache Python site-package
uses: actions/cache@v2
id: python
with:
path: |
${{ env.pythonLocation}}/bin
${{ env.pythonLocation}}/lib/python3.9/site-packages
key: ${{ runner.os }}-python
- name: Validate Python site-package
uses: techservicesillinois/cache-validation@v1
id: cache
with:
path: |
${{ env.pythonLocation}}/bin
${{ env.pythonLocation}}/lib/python3.9/site-packages
cache_hit: ${{ steps.python.outputs.cache-hit }}
- name: Upgrade pip
if: steps.cache.outputs.valid != 'true'
run: python -m pip install --upgrade --upgrade-strategy eager pip
```
The action works by taking a list of paths, and on a cache miss
generating a MD5SUMS file in each given directory after all steps
have executed. The MD5SUMS file contains a hash and path to every
file found recursively in the directory.
On a cache hit the action uses the MD5SUMS files to verify the
contents of each directory at the time and place where it is invocated
in the yaml file. If files are missing or invalid then the output
`valid` is set to `false`. If `fatal` is set to `true` then the
action will return `1` which will cause the pipeline to fail,
otherwise `0` is always returned so that the workflow can recover
from the corrupted cache by rebuilding its contents.
## Inputs/Outputs
See [action.yml](action.yml).