feat: push paths via stdin (closes #27)
Some checks failed
Test / test-cache (macos-latest) (push) Has been cancelled
Test / test-cache (ubuntu-latest) (push) Has been cancelled

This commit is contained in:
Ryan Cao 2024-10-11 11:05:57 +08:00
parent cdb11a7aa0
commit 7d151bb986
No known key found for this signature in database
GPG key ID: 48C96B2057D71CB1
3 changed files with 11 additions and 28 deletions

View file

@ -11,14 +11,13 @@
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"just-split": "^3.2.0"
"@actions/io": "^1.1.3"
},
"devDependencies": {
"@types/node": "^20.16.10",
"esbuild": "^0.24.0",
"prettier": "3.3.3",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"packageManager": "pnpm@9.12.0+sha512.4abf725084d7bcbafbd728bfc7bee61f2f791f977fd87542b3579dcb23504d170d46337945e4c66485cd12d588a0c0e570ed9c477e7ccdd8507cf05f3f92eaca"
"packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4"
}

View file

@ -17,9 +17,6 @@ importers:
'@actions/io':
specifier: ^1.1.3
version: 1.1.3
just-split:
specifier: ^3.2.0
version: 3.2.0
devDependencies:
'@types/node':
specifier: ^20.16.10
@ -31,8 +28,8 @@ importers:
specifier: 3.3.3
version: 3.3.3
typescript:
specifier: ^5.6.2
version: 5.6.2
specifier: ^5.6.3
version: 5.6.3
packages:
@ -204,9 +201,6 @@ packages:
engines: {node: '>=18'}
hasBin: true
just-split@3.2.0:
resolution: {integrity: sha512-hh57dN5koTBkmg3T6gBFISVVaW5bgZ6Ct1W5KODD5M7hQJKqGzTKkfMwOil8MBxyztLQEjh/v6UGXE8cP5tnqQ==}
prettier@3.3.3:
resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==}
engines: {node: '>=14'}
@ -216,8 +210,8 @@ packages:
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
typescript@5.6.2:
resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==}
typescript@5.6.3:
resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==}
engines: {node: '>=14.17'}
hasBin: true
@ -351,13 +345,11 @@ snapshots:
'@esbuild/win32-ia32': 0.24.0
'@esbuild/win32-x64': 0.24.0
just-split@3.2.0: {}
prettier@3.3.3: {}
tunnel@0.0.6: {}
typescript@5.6.2: {}
typescript@5.6.3: {}
undici-types@6.19.8: {}

View file

@ -1,7 +1,6 @@
import * as core from "@actions/core";
import { exec } from "@actions/exec";
import split from "just-split";
import { saveStorePaths, getStorePaths } from "../utils";
export const push = async () => {
@ -26,16 +25,9 @@ export const push = async () => {
(p) => !p.endsWith(".drv") && !p.endsWith(".drv.chroot") && !p.endsWith(".check") && !p.endsWith(".lock"),
);
const splitAddedPaths = split(addedPaths, 25);
for (const addedPaths of splitAddedPaths) {
await exec("attic", ["push", cache, ...addedPaths]);
}
// https://github.com/zhaofengli/attic/pull/176
// await exec("attic", ["push", cache, "--stdin"], {
// input: Buffer.from(addedPaths.join("\n")),
// });
await exec("attic", ["push", "--stdin", cache], {
input: Buffer.from(addedPaths.join("\n")),
});
}
} catch (e) {
core.warning(`Action encountered error: ${e}`);