Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.3 KB
Raw Blame
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { test } from "node:test";
import { resolve } from "node:path";

const workflowPath = resolve(".github/workflows/docker-publish.yml");

function ghaCacheExports(): string[] {
  return readFileSync(workflowPath, "utf8")
    .split("\n")
    .map((line) => line.trim())
    .filter((line) => line.startsWith("cache-to:"))
    .map((line) => line.slice("cache-to:".length).trim())
    .filter((config) => config.split(",").some((option) => option.trim() === "type=gha"));
}

test("Docker publish treats every GitHub Actions cache export as best effort", () => {
  const exports = ghaCacheExports();
  const scopes = exports
    .map((config) => {
      const scope = config
        .split(",")
        .map((option) => option.trim())
        .find((option) => option.startsWith("scope="));
      return scope?.slice("scope=".length);
    })
    .sort();

  assert.deepEqual(scopes, [
    "docker-${{ matrix.arch }}",
    "docker-bun-base-${{ matrix.arch }}",
    "docker-bun-web-${{ matrix.arch }}",
    "docker-web-${{ matrix.arch }}",
  ]);

  for (const config of exports) {
    assert.ok(
      config.split(",").some((option) => option.trim() === "ignore-error=true"),
      `GitHub Actions cache export must be best effort: ${config}`
    );
  }
});