Giter Site home page Giter Site logo

martijnhols / actions-cache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from actions/cache

22.0 22.0 6.0 9.96 MB

Enhanced actions/cache: Get full control over caching

License: MIT License

TypeScript 96.61% JavaScript 1.51% Shell 1.88%
actions caching github github-actions

actions-cache's Introduction

actions-cache's People

Contributors

aiqiaoy avatar aparna-ravindra avatar bishal-pdmsft avatar brcrista avatar chrispat avatar dependabot[bot] avatar dhadka avatar elhoussinet avatar guilleijo avatar hugovk avatar jhutchings1 avatar joshmgross avatar konradpabjan avatar koogawa avatar kotewar avatar leostera avatar lvpx avatar magnetikonline avatar manuelroth avatar martijnhols avatar nogic1008 avatar nomeata avatar phantsure avatar pimterry avatar smorimoto avatar t-dedah avatar thboop avatar tiwarishub avatar yuichkun avatar zarenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

actions-cache's Issues

Restore does not find cache key even though it seems to exist

Given the following yaml:

      - name: Check if cache key exists
        uses: martijnhols/actions-cache/[email protected]
        id: cache_exists
        with:
          path: .venv
          key: ${{ runner.os }}-python-deps-${{ hashFiles('poetry.lock') }}

      - name: Set up Python
        uses: actions/setup-python@v4
        if: steps.cache_exists.outputs.cache-hit != 'true'
        with:
          python-version: ${{ env.PYTHON_VERSION }}

      - name: Restore dependency cache
        uses: actions/cache@v3
        if: steps.cache_exists.outputs.cache-hit != 'true'
        id: deps-cache
        with:
          path: .venv
          key: ${{ runner.os }}-python-deps-${{ hashFiles('poetry.lock') }}

I get this output:
Screenshot 2023-06-29 at 7 47 57 PM

Comparing the keys, they look identical (copy pasted manually from output):

  • Linux-python-deps-905d6047b1ef7816097d7c2ed5d59e9334470b45f129b2df87b40a4f33058e2a
  • Linux-python-deps-905d6047b1ef7816097d7c2ed5d59e9334470b45f129b2df87b40a4f33058e2a

If cache is not hist in restore, there is not cache-hit output

Hi !

Looking at the code, it seems that the branch managing the cache not hit in restore.ts doesn't set output before returning:

         if (!cacheKey) {
            const message = `Cache not found for input keys: ${[
                primaryKey,
                ...restoreKeys
            ].join(", ")}`;
            if (isCacheRequired()) {
                throw new Error(message);
            } else {
                core.info(message);
                // I expected to have an utils.setCacheHitOutput(false); here
                return false;
            }
        }

I may be missing something here, If right I can write you the PR.

Thanks !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.