Skip to content

ENH: Use file glob for external data cache key in GHA workflows - #2572

Merged
blowekamp merged 1 commit into
SimpleITK:mainfrom
blowekamp:GHA-external-data-cache-glob
Apr 29, 2026
Merged

blowekamp merged 1 commit into
SimpleITK:mainfrom
blowekamp:GHA-external-data-cache-glob

Conversation

@blowekamp

Copy link
Copy Markdown
Member

Summary

Replace the "Generate External Data Hash" step (which ran git log on Testing/Data/ and piped the output to a temp file) with a direct hashFiles('Testing/Data/**') glob in the actions/cache key. This is simpler, removes the intermediate shell step and temp file, and correctly reflects content changes rather than relying on commit history.

Changes across all 4 workflows (Build.yml, BatchBuild.yml, Nightly.yml, Package.yml):

  • Remove the Generate External Data Hash step
  • Use hashFiles('Testing/Data/**') directly as the cache key
  • Bump cache key version to external-data-v2-
  • Add lookup-only: ${{ github.event_name == 'pull_request' }} so the cache is only written on pushes to named branches, not on PR runs

@blowekamp
blowekamp marked this pull request as ready for review April 29, 2026 14:05
@blowekamp
blowekamp requested review from hjmjohnson and zivy April 29, 2026 14:05
@blowekamp
blowekamp force-pushed the GHA-external-data-cache-glob branch from 5dd2c3e to ac6b312 Compare April 29, 2026 14:32
Replace the 'Generate External Data Hash' step (which used git log
output piped to a temp file) with a direct hashFiles() glob over
Testing/Data/**. This is simpler, more reliable, and removes the
intermediate hashable file.

Create a reusable composite action at .github/actions/external-data-cache
that handles cache restore/save logic. Uses actions/cache/restore on
pull_request events so the cache is restored but not saved, preventing
PR runs from creating duplicate cache entries. Full actions/cache
(restore + save) is used on push and other events.
@blowekamp
blowekamp force-pushed the GHA-external-data-cache-glob branch from ac6b312 to 596d8d4 Compare April 29, 2026 14:36
@blowekamp
blowekamp merged commit 73ea488 into SimpleITK:main Apr 29, 2026
32 of 33 checks passed
@blowekamp
blowekamp deleted the GHA-external-data-cache-glob branch September 9, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants