CI: Add a composite action for downloading GMT cache - #4858
Conversation
Six workflows (benchmarks, ci_docs, ci_doctests, ci_tests, ci_tests_dev and
ci_tests_legacy) each carried their own copy of the step that downloads the
'gmt-cache' artifact into ~/.gmt. All six were functionally identical; the only
differences were comment drift.
Replace them with a local composite action at
.github/actions/download-gmt-cache, which removes 48 lines and adds 6.
Note that composite actions do not inherit the job's 'defaults.run.shell', so the
action sets 'shell: bash -l {0}' explicitly to match the workflows.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The 'Ensure hyphens are not used in names of directories and Python files' step in style_checks.yaml greps every tracked directory, so '.github/actions/download-gmt-cache' would have failed CI. Rename it to 'download_gmt_cache'. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
@weiji14 Do you have any comments on this PR? |
|
The code itself looks fine, I'm just not sure how I feel yet about more AI-assisted contributions, whether it should be encouraged or not (should talk about in #4759). |
Personally, I encourage AI assistance in contributing, but the contributor should be able to understand and explain the changes. Anyway, it should be discussed in #4759. |
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
This reverts commit b7dcf00.
|
Currently, the composite action is called |
|
I have a question. Would this fix help avoid test failures caused by remote data download issues? Would it make sense to port this composite action pattern to GMT (the core repo) as well, for its own CI workflows? |
|
GMT already caches the remote datasets in GitHub Actions. The CI failures on the GMT side is unrelated to changes in this PR, but due to a different reason. Will open a PR to GMT. |
What this does
Six workflows each carried their own copy of the step that downloads the
gmt-cacheartifact into
~/.gmt:benchmarks,ci_docs,ci_doctests,ci_tests,ci_tests_devandci_tests_legacy.They now share
.github/actions/download-gmt-cache:Possible follow-ups, deliberately not done here
Get current week number of year(4 workflows) andmake install(5 workflows) arealso duplicated, but they are 1-2 lines each, so wrapping them likely costs more in
indirection than it saves.
Idea by @seisman, and implemented by Claude Code