actions / actions/cache

Trying to cache android sdk or cmdline tools doesn't work due to invalid path warning while path exists

Open
#1,534 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

I'm working on a github actions workflow that installs comdline tools and sdk packages every run and I want to cache these directories

       - name: Restore Android SDK Cache
          uses: actions/cache@v3
          with:
           path: $HOME/android-sdk
           key: ${{ runner.os }}-android-sdk 

I get this warning in Post Restore Android SDK Cache step and nothing is cached even after first run:

Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

this is the action where I download cmdline tools

      - name: Download Android Command Line Tools
        run: |
          set -e
          SDK_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip"

          mkdir -p $HOME/android-sdk/cmdline-tools
          curl -o sdk-tools.zip $SDK_TOOLS_URL
          unzip -q sdk-tools.zip -d $HOME/android-sdk/cmdline-tools
          mv $HOME/android-sdk/cmdline-tools/cmdline-tools $HOME/android-sdk/cmdline-tools/latest
          rm sdk-tools.zip
          echo "Setup completed. Directory structure:"
          tree $HOME/android-sdk/cmdline-tools || ls -R $HOME/android-sdk/cmdline-tools 

I have tried so many things and I tried to set the cache step before and after the download step but nothing works

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the actions/cache@v3 path input and the Download Android Command Line Tools step, checking the resolved directory after the download rather than only the configured string. Re-run the workflow and verify the post-cache step no longer reports the Path Validation Error and that a later run restores or saves the cache.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, github-actions, shell
Domain
ci-cd, mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.