Skip to content

Commit

Permalink
fix: split up added paths to avoid argument limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanccn committed Aug 4, 2023
1 parent 7af24dd commit e78c87f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"just-split": "^3.2.0",
"ofetch": "^1.1.1"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

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

7 changes: 6 additions & 1 deletion src/stages/push.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as core from "@actions/core";
import { exec } from "@actions/exec";

import splitArray from "just-split";
import { getStorePaths } from "../utils";

export const push = async () => {
Expand All @@ -21,7 +23,10 @@ export const push = async () => {
(p) => !p.endsWith(".drv") && !p.endsWith(".drv.chroot") && !p.endsWith(".check") && !p.endsWith(".lock"),
);

await exec("attic", ["push", cache, ...addedPaths]);
const splitAddedPaths = splitArray(addedPaths, 25);
for (const addedPaths of splitAddedPaths) {
await exec("attic", ["push", cache, ...addedPaths]);
}
}
} catch (e) {
core.setFailed(`Action failed with error: ${e}`);
Expand Down

0 comments on commit e78c87f

Please sign in to comment.