Skip to content

Commit 0027d39

Browse files
committed
Revert "new: Delete cache older than 14 days."
This reverts commit 0716d00.
1 parent 0716d00 commit 0027d39

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ The following optimizations and considerations are taken into account when cachi
9393
crate, a checkout will be performed on-demand.
9494
- The `/registry` directory is _cleaned_ before saving the cache. This includes removing `src`,
9595
`.cache`, and any other unnecessary files.
96-
- Registry artifacts older than 14 days will be removed.
9796
- `/target/debug`
9897
- Only the `debug` profile is cached, as this profile is typically used for formatting, linting,
9998
and testing.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "@moonrepo/setup-rust",
3-
"version": "0.4.2",
3+
"version": "0.4.1",
44
"description": "A GitHub action for setting up Rust and Cargo.",
55
"main": "dist/index.js",
66
"scripts": {
77
"build": "ncc build ./index.ts && ncc build ./post.ts --out ./dist/post",
8-
"check": "pnpm run lint && pnpm run typecheck",
8+
"check": "npm run lint && npm run typecheck",
99
"lint": "eslint --ext .ts,.js --fix .",
1010
"typecheck": "tsc --noEmit"
1111
},

src/cargo.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as core from '@actions/core';
77
import * as exec from '@actions/exec';
88
import * as glob from '@actions/glob';
99
import * as tc from '@actions/tool-cache';
10-
import { padDate, rmrf } from './helpers';
10+
import { rmrf } from './fs';
1111
import { RUST_HASH, RUST_VERSION } from './rust';
1212

1313
export const CARGO_HOME = process.env.CARGO_HOME ?? path.join(os.homedir(), '.cargo');
@@ -129,19 +129,7 @@ export async function cleanCargoRegistry() {
129129
const registryDir = path.join(CARGO_HOME, 'registry');
130130

131131
// .cargo/registry/src - Delete entirely
132-
const staleDate = new Date();
133-
134-
// eslint-disable-next-line no-magic-numbers
135-
staleDate.setDate(staleDate.getDate() - 14);
136-
137-
await exec.exec('cargo', [
138-
'cache',
139-
'--autoclean',
140-
'--remove-if-older-than',
141-
`${staleDate.getFullYear()}.${padDate(staleDate.getMonth() + 1)}.${padDate(
142-
staleDate.getDate(),
143-
)}`,
144-
]);
132+
await exec.exec('cargo', ['cache', '--autoclean']);
145133

146134
// .cargo/registry/index - Delete .cache directories
147135
const indexDir = path.join(registryDir, 'index');

src/helpers.ts renamed to src/fs.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ export async function rmrf(dir: string) {
1010
core.warning(`Failed to delete ${dir}: ${error}`);
1111
}
1212
}
13-
14-
export function padDate(value: number) {
15-
return String(value).padStart(2, '0');
16-
}

0 commit comments

Comments
 (0)