v0.1.0 28f9d6e

env.mjs RawHistoryFolder

1// SPDX-License-Identifier: MIT
2//
3// Shared by the scripts of this directory: finds the runner driver, and checks
4// that the clone it was built from is the one the recorded data is about and
5// that the .NET runtime is the 9.0 line (number formatting and case folding come
6// from the runtime, not from the SDK).
7//
8//   RUNNER_CLONE=/path/to/actions/runner node expr/gen/runner/<script>.mjs
9
10import { execFileSync } from "node:child_process";
11import { readFileSync } from "node:fs";
12import { join, dirname } from "node:path";
13import { fileURLToPath } from "node:url";
14
15export const here = dirname(fileURLToPath(import.meta.url));
16
17/** The commit of actions/runner the data in testdata/ is about (runner-commit.txt). */
18export const runnerCommit = readFileSync(join(here, "runner-commit.txt"), "utf8").trim();
19
20/** The driver built by `dotnet build -c Release expr/gen/runner -p:RunnerSrc=<clone>/src/Sdk`. */
21export const driver = join(here, "bin/Release/net9.0/runner.dll");
22
23/**
24 * Checks the environment and returns { clone, commit, runtime }. The clone is
25 * $RUNNER_CLONE (or the first argument); its HEAD must be runner-commit.txt and
26 * its tree clean in src/Sdk, and `dotnet --list-runtimes` must list a
27 * Microsoft.NETCore.App 9.0.x.
28 */
29export function checkEnvironment(arg) {
30  const clone = process.env.RUNNER_CLONE || arg;
31  if (!clone) throw new Error("set RUNNER_CLONE to a clone of https://github.com/actions/runner");
32  const git = (...a) => execFileSync("git", ["-C", clone, ...a]).toString().trim();
33  const commit = git("rev-parse", "HEAD");
34  if (commit !== runnerCommit) throw new Error(`the clone is at ${commit}, the data is about ${runnerCommit} (runner-commit.txt)`);
35  if (git("status", "--porcelain", "--", "src/Sdk") !== "") throw new Error("the clone has local changes in src/Sdk");
36  const rt = execFileSync("dotnet", ["--list-runtimes"]).toString().split("\n").filter(l => /^Microsoft\.NETCore\.App 9\.0\.\d+ /.test(l));
37  if (rt.length === 0) throw new Error("no Microsoft.NETCore.App 9.0.x runtime installed (dotnet --list-runtimes)");
38  return { clone, commit, runtime: rt[rt.length - 1].replace(/ \[.*$/, "") };
39}
40
41/** Runs the driver with args; the environment is checked first. */
42export function runDriver(args, opts = {}) {
43  checkEnvironment();
44  return execFileSync("dotnet", [driver, ...args], { maxBuffer: 1 << 30, ...opts }).toString("utf8");
45}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 3

↑↓ moveenter openesc close