question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

404 when including github.ref in key

See original GitHub issue

With config like this:

    - name: Ubuntu cache
      uses: actions/cache@preview
      if: startsWith(matrix.os, 'ubuntu')
      with:
        path: ~/.cache/pip
        key: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}

    - name: macOS cache
      uses: actions/cache@preview
      if: startsWith(matrix.os, 'macOS')
      with:
        path: ~/Library/Caches/pip
        key: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}

It creates a key like "Test-refs/heads/gha-cache-ubuntu-18.04-3.5".

The upload step fails with a 404:

Post Ubuntu cache1s
##[warning]Cache service responded with 404
Post job cleanup.
/bin/tar -cz -f /home/runner/work/_temp/802beeb6-cc68-45cb-a68d-488cc4008df5/cache.tgz -C /home/runner/.cache/pip .
##[warning]Cache service responded with 404

eg. https://github.com/hugovk/Pillow/runs/286812478#step:22:1

That’s because github.ref includes slashes (eg. refs/heads/gha-cache):

The branch or tag ref that triggered the workflow. For example, refs/heads/feature-branch-1. If neither a branch or tag is available for the event type, the variable will not exist.

https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions#environment-variables

Should I escape or replace illegal characters (and how?) or should the Action take care of them?

Or is there another way to include the branch name in the key?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
joshmgrosscommented, Nov 5, 2019

Does that include “inheriting” the caches from the base branch of a pull request? ie when building a pull request targeting master the first time, will that pick up the cache from master?

Yep, PRs are able to read from the cache of master (or default branch) but will write to the cache of the PR branch. We’re working on more comprehensive documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - GitHub Docs
404 error for an existing repository. Typically, we send a 404 error when your client isn't properly authenticated. You might expect to see...
Read more >
How to fix HTTP 404 on Github Pages? - Stack Overflow
I had just one commit with all my files. I pushed an empty commit, refreshed the page and it worked. git commit --allow-empty...
Read more >
Adding a github SSH checkout key fails on API 1.1 with 404
Hello there! I have written a small npm module that will use the CircleCI API to add a checkout SSH key for the...
Read more >
Git command returns "not found" or error code 404
When pulling from, pushing or cloning to Bitbucket Server, it responds with the error code 404. $ git push URL master fatal: URL/info/refs...
Read more >
GitHub: a case study in link maintenance and 404 pages
I think they just break links for the fun of it. With GitHub, it's partially inherent (user content changes) and partially an artefact...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found