Compare commits

..

2 Commits

Author SHA1 Message Date
Antoine Toulme
98eec3aa50 Merge 3b3fb41561 into b7e8d49f17 2026-02-03 15:13:10 +01:00
github-actions[bot]
3b3fb41561 Offer a strategy to reduce cache churn 2025-08-07 23:20:34 -07:00
4 changed files with 297 additions and 5274 deletions

View File

@@ -287,3 +287,26 @@ steps:
- name: Publish package to public
run: ./publish.sh
```
### Saving cache only if the build runs on the default branch
Workflow runs can restore caches created in either the current branch or the default branch (usually `main`) [Reference](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache).
By restricting caches to the default branch, we can reduce the risk that Github evicts a cache created on the default branch. If that happens, every PR will create its own cache, increasing the cache churn.
We can condition the execution of the `actions/cache/save` action on the current branch:
```yaml
steps:
- uses: actions/checkout@v3
.
. // restore if need be
.
- name: Build
run: /build.sh
- uses: actions/cache/save@v3
if: ${{ github.ref == 'refs/heads/main' }} // check we are on the default branch
with:
path: path/to/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
```

View File

@@ -49,7 +49,7 @@
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
```
### Windows
@@ -59,7 +59,7 @@
with:
path: |
~\.bun
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
```
## C# - NuGet

5540
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,7 @@
"@actions/io": "^2.0.0"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/jest": "^29.5.14",
"@types/nock": "^11.1.0",
"@types/node": "^24.1.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
@@ -41,7 +41,7 @@
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.5.3",
"eslint-plugin-simple-import-sort": "^12.1.1",
"jest": "^30.2.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"nock": "^13.2.9",
"prettier": "^3.6.2",