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.

Wrong ref set for cache on release.type.published with explicit branch checkout

See original GitHub issue

I have a workflow that is triggered on release

on:
  release:
    types: [published]

And I set ref to main branch explicitly for checkout action, because cache with tags’ refs are cannot be reused for feature branches, see #556 . Checking out for main branch is ok for me as it’s the same code version as the last release.

      - name: Checkout main branch
        uses: actions/checkout@v3
        with:
          ref: main

Anyway the cache is created with the tag ref

curl \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token MY_TOKEN" \
  https://api.github.com/repos/org/repo/actions/caches

{
  "total_count": 5,
  "actions_caches": [
    {
      "id": 8,
      "ref": "refs/tags/<TAG>",
      "key": "MY_KEY",
      "version": "...",
      "last_accessed_at": "2022-07-04T11:58:15.810000000Z",
      "created_at": "2022-07-04T11:58:15.810000000Z",
      "size_in_bytes": 76343
    },
    ...
  ]
}

And for the feature branch the cache is not visible anyway:

Run actions/cache@v3
Cache not found for input keys: MY_KEY

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
bishal-pdMSFTcommented, Nov 16, 2022

The doc section is updated to call out the scope restrictions more clearly. Also added a sentence about tags scope.

1reaction
bishal-pdMSFTcommented, Aug 19, 2022

Got it. It wouldn’t harm to mention this explicitly in the docs. Let me plan for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cache dependencies and build outputs in GitHub Actions
cache. This action allows caching dependencies and build outputs to improve workflow execution time. In addition to this cache action, other two actions...
Read more >
error: pathspec '...' did not match any file(s) known to git - Stack ...
I was getting this error when I tried to checkout new branch: error: pathspec 'BRANCH-NAME' did not match any file(s) known to git....
Read more >
Trying GitHub Actions - Gleb Bahmutov
I have cloned actions/cache into cypress-io/github-actions-cache and have refactored the code in branch reusable-functions to allow using ...
Read more >
GitHub Actions for .NET Core NuGet packages - Dusted Codes
In GitHub, under Settings and then Branches, one can set up branch ... and therefore the published type has to be specified explicitly....
Read more >
7 Github Actions Tricks I Wish I Knew Before I Started
The workflow will trigger on every pull request to the main branch. Not only that, it will also trigger for any push to...
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