Skip to content

Commit

Permalink
feat: push paths via stdin (closes #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Oct 11, 2024
1 parent cdb11a7 commit 7d151bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected].0+sha512.4abf725084d7bcbafbd728bfc7bee61f2f791f977fd87542b3579dcb23504d170d46337945e4c66485cd12d588a0c0e570ed9c477e7ccdd8507cf05f3f92eaca"
"packageManager": "[email protected].1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4"
}
18 changes: 5 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions src/stages/push.ts
Original file line number Diff line number Diff line change
@@ -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 () => {
Expand All @@ -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}`);
Expand Down

0 comments on commit 7d151bb

Please sign in to comment.