Skip to content

fix(action): set cache-dependency-path to action's pyproject.toml - #5

Merged
KyleJamesWalker merged 2 commits into
mainfrom
fix/setup-python-cache-dependency-path
May 21, 2026
Merged

fix(action): set cache-dependency-path to action's pyproject.toml#5
KyleJamesWalker merged 2 commits into
mainfrom
fix/setup-python-cache-dependency-path

Conversation

@KyleJamesWalker

Copy link
Copy Markdown
Owner

Summary

  • Fixes action failing in non-Python consumer repos (e.g. Docker image repos)
  • setup-python with cache: pip searches the caller's workspace for requirements.txt or pyproject.toml by default — those files don't exist in non-Python repos
  • Explicitly sets cache-dependency-path to ${{ github.action_path }}/pyproject.toml so caching always resolves to the action's own dependency file

Test plan


(\__/)
(+'.'+)
(")_(")

Bunny helped with this PR and is one step closer to world domination...

setup-python cache: pip searches the caller's workspace for requirements.txt or pyproject.toml by default. Consumer repos that aren't Python projects don't have these files, causing the action to fail. Explicitly pointing cache-dependency-path to the action's own pyproject.toml ensures caching always works regardless of the caller's repo structure.

Made-with: Bunny
cache: pip requires a requirements file in the workspace. When the action is tested locally with uses: ./, github.action_path contains relative path components that cache-dependency-path rejects. The pip install is fast enough that caching adds no meaningful value.

Made-with: Bunny
@KyleJamesWalker
KyleJamesWalker merged commit cd8a9a8 into main May 21, 2026
8 checks passed
@KyleJamesWalker
KyleJamesWalker deleted the fix/setup-python-cache-dependency-path branch May 21, 2026 22:22
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.

1 participant