perf: cache apt-get update

This commit is contained in:
Amin Yahyaabadi 2021-09-15 03:39:35 -05:00
parent 064da1045c
commit 9e16dda2d6
1 changed files with 5 additions and 1 deletions

View File

@ -1,9 +1,13 @@
/* eslint-disable require-atomic-updates */
import { exec } from "@actions/exec"
let didUpdate: boolean = false
/** A function that installs a package using apt */
export async function setupAptPack(name: string, version?: string, updateRepositories: boolean = true) {
if (updateRepositories) {
if (!didUpdate || updateRepositories) {
await exec("apt-get", ["update"])
didUpdate = true
}
const exit = await exec("apt-get", ["install", version !== undefined ? `${name}=${version}` : name])