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.

Cache not requesed (not found) between workflows

See original GitHub issue

Hi!

I have a shared (called) workflow, which I am reusing between few others. As an input param it receive a sha for the commit code. This sha is used as a key. As result, when I run sequently those workflows with same sha

  • for the first one cache obviously is empty, so caching happened
  • for the second workflow cache should be present, but it missed

Here is my called workflow

name: Prepare code

on:
  workflow_call:
    inputs:
      commit_sha:
        required: true
        type: string

jobs:
  main:
    runs-on: ubuntu-latest

    steps:

      - name: 📦 Activate cache for last commited code
        id: cached-commit
        uses: actions/cache@v3
        with:
          path: ./
          key: ${{ inputs.commit_sha }}

      - name: ⏬ Checkout repo last commit
        if: steps.cached-commit.outputs.cache-hit != 'true'
        uses: actions/checkout@v2
        with:
          ref: ${{ inputs.commit_sha }}

And here is how I call it from 2 other workflows:

jobs:

  Prepare_code:
    uses: ./.github/workflows/prepare_code.yaml
    with:
      commit_sha: ${{ github.event.pull_request.head.sha }}
jobs:

  Prepare_code:
    uses: ./.github/workflows/prepare_code.yaml
    with:
      commit_sha: ${{ github.sha }}

Am I doing something wrong? Thanks 🙏🏼

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pro100svitlocommented, Aug 19, 2022

Got it 😉

Thank you for your help! Have a nice day!

0reactions
aparna-ravindracommented, Aug 19, 2022

Unfortunately, no. Caches created on the default branch can be reused in other branches. But no other reusability is possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

can NOT find cache · Issue #539 · actions/setup-node - GitHub
A workflow can access and restore a cache created in the current branch, the base branch (including base branches of forked repositories), or ......
Read more >
Github Actions Reusable workflows yarn cache not found
Therefore, if I run yarn in workflow 1's container, workflow 2 has no knowledge/access to the cache.
Read more >
Edit service caching properties in ArcGIS Server Manager ...
This topic explains the map and image cache properties available in ArcGIS ... Server Manager, those dependent on geoprocessing tools are not available....
Read more >
Caching Strategies - CircleCI
Order jobs to create meaningful workflows ... If no job ordering is used in a workflow all jobs run concurrently. If all the...
Read more >
Between workflow caching — Snakemake 7.19.1 documentation
Hence, caching is not intended for private data, just for steps that deal with publicly available resources. Finally, be aware that the implementation...
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