Repository navigation
Add a save-cache input for callers where only the default branch saves caches - #12
Merged
Merged
Conversation
Verified: test/save-cache/restore-only.py against the changed action.yml; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…action still installs Verified: test/save-cache/restore-only.py against the changed action.yml; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
Verified: test/save-cache/restore-only.py against the changed action.yml; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
Verified: test/save-cache/restore-only.py against the changed action.yml; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…s text holds no expression Verified: test/save-cache/restore-only.py passes on this action.yml and fails on the previous one (expression in a description, an ungated parse cache step); actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
Verified: test/save-cache/restore-only.py passes on this action.yml and fails on the previous one (expression in a description, an ungated parse cache step); actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
Verified: test/save-cache/restore-only.py passes on this action.yml and fails on the previous one (expression in a description, an ungated parse cache step); actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…or default Verified: test/save-cache/restore-only.py passes on this action.yml and fails on the previous one (expression in a description, an ungated parse cache step); actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…ranch Verified: test/save-cache/decision.sh (eleven fabricated events, schedule included); test/save-cache/restore-only.py; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…cluded Verified: test/save-cache/decision.sh (eleven fabricated events, schedule included); test/save-cache/restore-only.py; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…s-cache output Verified: test/save-cache/decision.sh (eleven fabricated events, schedule included); test/save-cache/restore-only.py; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
…nd run the decision unit test Verified: test/save-cache/decision.sh (eleven fabricated events, schedule included); test/save-cache/restore-only.py; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
Verified: test/save-cache/decision.sh (eleven fabricated events, schedule included); test/save-cache/restore-only.py; actionlint on test.yml Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
save-cacheinput:true(the default, unchanged for everyv1caller),default-branchorfalse.Why. In neokapi/neokapi only the default branch saves caches. The action saved its caches on every ref, pull requests included: binary, plugins, and a parse cache keyed by run. They were never read again and used that repository's cache budget. A caller there will pass
save-cache: default-branch.How.
scripts/save-cache-decision.shto turn the input into a yes or no for the run, and exposes it as thesaves-cacheoutput:trueis yes;falseis no.default-branchis yes on aschedulerun, which GitHub runs on the default branch only and whose payload names no repository. It is also yes whengithub.refisrefs/heads/<github.event.repository.default_branch>. The branch name comes from the event, not a literal, so this works in any repository. In every other case, where the branch cannot be told, it is no.actions/cachestep runs only on yes. A twinactions/cache/restorestep, with the same path and key, runs on no;actions/cache/restorenever saves.cache-hitoutput reads whichever ran.pull_request_target,workflow_runandissue_commentalso covers a "no".Tests.
test/save-cache/restore-only.pychecks two things. Every saving cache step follows the decision and has a restore-only twin. And no input's description or default holds an expression, other than${{ github.token }}astoken's default. It fails on the first push'saction.ymlfor both reasons.test/save-cache/decision.shunit-tests the decision over eleven fabricated events: each value, a pull request, a push tomainand to atrunkdefault branch, a dispatch, aworkflow_run, aschedulewith no repository in its payload, and an invalid value.test-save-cacheruns each value (false,default-branch,true) with the bowrain plugin and asserts the install, thecache-hitoutput, and thatsaves-cachematches the expected decision for the run.test-save-cache-invalidasserts thatsave-cache: maybefails.Not merged, and no tag moved.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GtGobCdyR3d9yLXAfX9jsr