[PR #2267] [MERGED] fix: cache adjust restore order of exact key matches #2359

Closed
opened 2026-03-01 21:55:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/2267
Author: @ChristopherHX
Created: 3/28/2024
Status: Merged
Merged: 3/29/2024
Merged by: @mergify[bot]

Base: masterHead: cache-fix-regression


📝 Commits (6)

📊 Changes

2 files changed (+115 additions, -0 deletions)

View changed files

📝 pkg/artifactcache/handler.go (+11 -0)
📝 pkg/artifactcache/handler_test.go (+104 -0)

📄 Description

Those workflows should pass without errors for the cache server

on:
  push:
jobs:
  testa:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
    
      - uses: actions/cache/save@v4
        with:
          path: .
          key: ${{ runner.os }}-${{ github.run_id }}-3
      - uses: actions/cache/save@v4
        with:
          path: .
          key: ${{ runner.os }}-${{ github.run_id }}-3-1
      - uses: actions/cache/restore@v4
        id: cache
        with:
          path: .
          key: ${{ runner.os }}-${{ github.run_id }}-3
      - name: Assert that we got a cache hit
        run: exit 1
        if: steps.cache.outputs.cache-hit != 'true'
on:
  push:
jobs:
  testa:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
    
      - uses: actions/cache/save@v4
        with:
          path: .
          key: ${{ runner.os }}-${{ github.run_id }}-3
      - uses: actions/cache/save@v4
        with:
          path: .
          key: ${{ runner.os }}-${{ github.run_id }}-3-1
      - uses: actions/cache/restore@v4
        id: cache
        with:
          path: .
          key: -----------------------------------------------------------
          restore-keys:
            ${{ runner.os }}-${{ github.run_id }}-3
      - name: Assert that we got a cache hit
        run: exit 1
        if: steps.cache.outputs.cache-matched-key != format('{0}-{1}-3', runner.os, github.run_id)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/2267 **Author:** [@ChristopherHX](https://github.com/ChristopherHX) **Created:** 3/28/2024 **Status:** ✅ Merged **Merged:** 3/29/2024 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `cache-fix-regression` --- ### 📝 Commits (6) - [`025d92f`](https://github.com/nektos/act/commit/025d92fa07fea5cc945bdda5492dc32c766940fd) wip: adjust restore order - [`d43316a`](https://github.com/nektos/act/commit/d43316aa9be126483bc240eb951c68351a2fe6de) fixup - [`085148c`](https://github.com/nektos/act/commit/085148cc2c8155a32b126142028e0204e156d1f8) add tests - [`a50e0e4`](https://github.com/nektos/act/commit/a50e0e4288ad4c035e9e317975a68d47c1ccf10e) cleanup - [`e974c46`](https://github.com/nektos/act/commit/e974c46fa90d6dcb2fb8fa87e4f669304d640bf0) fix typo - [`eb35766`](https://github.com/nektos/act/commit/eb3576610ec43863da171d80705ac3600c7f5310) Merge branch 'master' into cache-fix-regression ### 📊 Changes **2 files changed** (+115 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `pkg/artifactcache/handler.go` (+11 -0) 📝 `pkg/artifactcache/handler_test.go` (+104 -0) </details> ### 📄 Description Those workflows should pass without errors for the cache server ``` yaml on: push: jobs: testa: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/cache/save@v4 with: path: . key: ${{ runner.os }}-${{ github.run_id }}-3 - uses: actions/cache/save@v4 with: path: . key: ${{ runner.os }}-${{ github.run_id }}-3-1 - uses: actions/cache/restore@v4 id: cache with: path: . key: ${{ runner.os }}-${{ github.run_id }}-3 - name: Assert that we got a cache hit run: exit 1 if: steps.cache.outputs.cache-hit != 'true' ``` ```yaml on: push: jobs: testa: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/cache/save@v4 with: path: . key: ${{ runner.os }}-${{ github.run_id }}-3 - uses: actions/cache/save@v4 with: path: . key: ${{ runner.os }}-${{ github.run_id }}-3-1 - uses: actions/cache/restore@v4 id: cache with: path: . key: ----------------------------------------------------------- restore-keys: ${{ runner.os }}-${{ github.run_id }}-3 - name: Assert that we got a cache hit run: exit 1 if: steps.cache.outputs.cache-matched-key != format('{0}-{1}-3', runner.os, github.run_id) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:55:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#2359
No description provided.