setup-rust/helpers.ts
Miles Johnson 81acac128f Polish.
2023-04-17 14:13:30 -07:00

17 lines
569 B
TypeScript

import os from 'os';
import path from 'path';
import * as cache from '@actions/cache';
import * as core from '@actions/core';
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
export const CARGO_HOME = process.env.CARGO_HOME || path.join(os.homedir(), '.cargo');
export const CACHE_ENABLED = core.getBooleanInput('cache') || cache.isFeatureAvailable();
export function getPrimaryCacheKey(): string {
return `setup-rustcargo-${process.platform}`;
}
export function getPathsToCache(): string[] {
return [path.join(CARGO_HOME, 'registry')];
}