forked from stupidloud/cachewrtbuild
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathutils.js
More file actions
36 lines (30 loc) · 1.1 KB
/
utils.js
File metadata and controls
36 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as core from "@actions/core";
import { execSync } from "node:child_process";
import path from "node:path";
export function buildBaseConfig() {
const prefix = core.getInput("prefix");
if (prefix) {
process.chdir(prefix);
core.debug(`Changed working directory to: ${prefix}`);
}
const mixkey = core.getInput("mixkey");
let keyString = mixkey ? `${mixkey}-cache-openwrt` : "cache-openwrt";
const paths = [];
const cacheToolchain = core.getBooleanInput("toolchain");
if (cacheToolchain) {
const toolchainHash = execSync('git log --pretty=tformat:"%h" -n1 tools toolchain')
.toString()
.trim();
keyString += `-${toolchainHash}`;
paths.push(
path.join("staging_dir", "host*"),
path.join("staging_dir", "tool*")
);
}
const cacheCcache = core.getBooleanInput("ccache");
const otherPaths = core.getMultilineInput("extra_paths").filter(Boolean);
if (otherPaths.length > 0) {
paths.push(...otherPaths);
}
return { keyString, paths, cacheToolchain, cacheCcache };
}