actions / actions/cache

Skip saving cache when running in merge queue

Open
#1,798 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

This is essentially a duplicate of #1243, which was closed due to inactivity.

Caches saved in the merge queue are essentially useless, as they save on its own branch.

So they cannot be restored from the default branch, nor from any PR branch.
Essentially, as far as I can tell, any cache saved in a merge queue can only be used in the situation where:

  • PR is added into the merge queue. Github creates main/pr1 branch.
  • It fails and is sent back
  • It is resubmitted to the merge queue. I assume github will reuse the main/pr1 branch name, in which case you might be able to get a cache hit.

I would imagine that the most sensible default behaviour would be to not save a cache by default if we're in a merge_group action, or perhaps add an option to do so to the main cache action.

The workaround currently is to use explicit restore and save actions and checking if we're in a merge queue, but it's fairly cumbersome.

Related

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 by tracing how the cache action detects its execution context and handles save behavior for GitHub Actions merge queues. Compare the requested default behavior with the proposed opt-in alternative, then verify that the chosen behavior prevents unwanted merge-queue saves without changing normal branch and pull-request caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.