| 1 |
--- |
| 2 |
|
| 3 |
name: placeholder |
| 4 |
description: placeholder |
| 5 |
|
| 6 |
outputs: |
| 7 |
cache-key-for-dep-files: |
| 8 |
description: >- |
| 9 |
A cache key string derived from the dependency declaration files. |
| 10 |
value: ${{ steps.calc-cache-key-files.outputs.files-hash-key }} |
| 11 |
|
| 12 |
runs: |
| 13 |
using: composite |
| 14 |
steps: |
| 15 |
- name: >- |
| 16 |
Calculate dependency files' combined hash value |
| 17 |
for use in the cache key |
| 18 |
id: calc-cache-key-files |
| 19 |
run: | |
| 20 |
from os import environ |
| 21 |
from pathlib import Path |
| 22 |
|
| 23 |
FILE_APPEND_MODE = 'a' |
| 24 |
|
| 25 |
files_derived_hash = '${{ |
| 26 |
hashFiles( |
| 27 |
'tox.ini', |
| 28 |
'pyproject.toml', |
| 29 |
'.pre-commit-config.yaml', |
| 30 |
'pytest.ini', |
| 31 |
'requirements/**' |
| 32 |
) |
| 33 |
}}' |
| 34 |
|
| 35 |
print(f'Computed file-derived hash is {files_derived_hash}.') |
| 36 |
|
| 37 |
with Path(environ['GITHUB_OUTPUT']).open( |
| 38 |
mode=FILE_APPEND_MODE, |
| 39 |
) as outputs_file: |
| 40 |
print( |
| 41 |
f'files-hash-key={files_derived_hash}', |
| 42 |
file=outputs_file, |
| 43 |
) |
| 44 |
shell: python |
| 45 |
|
| 46 |
... |