Warn on mnc usage (#102)
Some checks failed
CI / Build (push) Has been cancelled
Push dev shell to FlakeHub Cache / push-dev-shell-to-flakehub-cache (map[nix-system:aarch64-darwin runner:macos-latest-xlarge]) (push) Has been cancelled
Push dev shell to FlakeHub Cache / push-dev-shell-to-flakehub-cache (map[nix-system:x86_64-darwin runner:macos-13]) (push) Has been cancelled
Push dev shell to FlakeHub Cache / push-dev-shell-to-flakehub-cache (map[nix-system:x86_64-linux runner:ubuntu-22.04]) (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: Nix not installed (push) Has been cancelled
CI / Run x86_64-linux, Untrusted (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:disabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:enabled,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:no-preference,id:none,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:disabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:enabled,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:no-preference,id:write,determinate:false (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:disabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:enabled,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:no-preference,id:none,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:disabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:enabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-darwin gha:no-preference,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:disabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:enabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: aarch64-linux gha:no-preference,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:disabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:enabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-darwin gha:no-preference,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:disabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:enabled,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:disabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:enabled,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / Test: x86_64-linux gha:no-preference,fhc:no-preference,id:write,determinate:true (push) Has been cancelled
CI / success (push) Has been cancelled

* Warn on mnc usage

* Only run the warning on MNC on a flag

* Update URL

* phrasing nits
This commit is contained in:
Graham Christensen 2025-01-21 12:29:49 -05:00 committed by GitHub
parent f7eb5b510a
commit 6221693898
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 1370 additions and 1 deletions

1285
dist/index.js generated vendored

File diff suppressed because it is too large Load diff

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -27,6 +27,7 @@
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.5.0",
"detsys-ts": "github:DeterminateSystems/detsys-ts",
"got": "^14.4.5",
"tail": "^2.2.6"

View file

@ -11,6 +11,9 @@ dependencies:
'@actions/exec':
specifier: ^1.1.1
version: 1.1.1
'@actions/glob':
specifier: ^0.5.0
version: 0.5.0
detsys-ts:
specifier: github:DeterminateSystems/detsys-ts
version: github.com/DeterminateSystems/detsys-ts/eb87094f35072ac911526ad052c3437c9e0c42d6
@ -104,6 +107,13 @@ packages:
minimatch: 3.1.2
dev: false
/@actions/glob@0.5.0:
resolution: {integrity: sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==}
dependencies:
'@actions/core': 1.11.1
minimatch: 3.1.2
dev: false
/@actions/http-client@2.2.3:
resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==}
dependencies:

View file

@ -1,4 +1,5 @@
import { getTrinaryInput, netrcPath, tailLog } from "./helpers.js";
import { warnOnMnc } from "./mnc-warn.js";
import * as actionsCore from "@actions/core";
import { DetSysAction, inputs, stringifyError } from "detsys-ts";
import got, { Got, Response } from "got";
@ -99,6 +100,10 @@ class MagicNixCacheAction extends DetSysAction {
return;
}
if (this.getFeature("warn-magic-nix-cache-eol")?.variant === true) {
await warnOnMnc();
}
if (this.nixStoreTrust === "untrusted") {
actionsCore.warning(TEXT_TRUST_UNTRUSTED);
return;

68
src/mnc-warn.ts Normal file
View file

@ -0,0 +1,68 @@
import actionsCore from "@actions/core";
import glob from "@actions/glob";
import { stringifyError } from "detsys-ts";
import * as fs from "node:fs/promises";
export async function warnOnMnc(): Promise<void> {
const cwd = process.cwd();
const patterns = [
".github/actions/*.yaml",
".github/actions/*.yml",
".github/workflows/*.yaml",
".github/workflows/*.yml",
];
const globber = await glob.create(patterns.join("\n"));
const files = await globber.glob();
for (const file of files) {
try {
const relativeFilePath = file.replace(cwd, ".");
const lines = (await fs.readFile(file, { encoding: "utf8" })).split("\n");
for (const lineIdx of lines.keys()) {
const line = lines[lineIdx];
if (
line
.toLowerCase()
.includes("determinatesystems/magic-nix-cache-action")
) {
const actionPosition = line
.toLowerCase()
.indexOf("determinatesystems/magic-nix-cache-action");
const actionPositionEnd =
actionPosition + "determinatesystems/magic-nix-cache-action".length;
const newLine = line.replace(
/DeterminateSystems\/magic-nix-cache-action/gi,
"DeterminateSystems/flakehub-cache-action",
);
actionsCore.warning(
[
"Magic Nix Cache has been deprecated due to a change in the underlying GitHub APIs and will stop working on 1 February 2025.",
"To continue caching Nix builds in GitHub Actions, use FlakeHub Cache instead.",
"",
"Replace...",
line,
"",
"...with...",
newLine,
"",
"For more details: https://dtr.mn/magic-nix-cache-eol",
].join("\n"),
{
title: "Magic Nix Cache is deprecated",
file: relativeFilePath,
startLine: lineIdx + 1,
startColumn: actionPosition,
endColumn: actionPositionEnd,
},
);
}
}
} catch (err) {
actionsCore.debug(stringifyError(err));
}
}
}