Files
mesh-catalog/modules/gitea/mainrules.ts
T
jschoubben 815be6bdce FORGE-6: the forge module's merge-check machinery and its polls go
announceHead with its mesh/merge-gate pending, the weighing of trunk and
sibling moves (passPulls, trunksMoved, siblingMoves, GateWriter) and their
files on disk, the pass's pull-passing half with its 60 s retry, and the
10-minute keep-main-rules step go. A pull request's new head is said as
pull.updated from the forge's event alone; the seat's status writes
through the client; pollRepos, pollMerged and readAllAtStart stay.

Builds: design 47 H §764 (the forge module: the merge-check machinery, its poll and timer), §762; H-A-28, H-A-100

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-20 03:54:09 +01:00

15 lines
825 B
TypeScript

// The setting keep-main-rules (the operator, 2026-10-23: "disable the gitea branch protection reset thing"): only when it
// is true does the module put main's rule right in every repository of the organisation (client.ts ensureMainMerges).
// False, the default, leaves every repository's branch protection as people set it at the forge.
import { readFileSync } from "node:fs";
/** The setting from the settings-merged config file the mesh delivers; absent, unreadable or not true is false. */
export function keepMainRules(env: NodeJS.ProcessEnv = process.env): boolean {
const file = env.MESH_GITEA_CONFIG_FILE;
if (!file) return false;
try {
const v = (JSON.parse(readFileSync(file, "utf8")) as Record<string, unknown>)["keep-main-rules"];
return v === true || v === "true";
} catch { return false; }
}