From 2c45c8158b2a3f94d4874429ed9d1d468796650a Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 14 Jul 2026 13:21:49 +0100 Subject: [PATCH] Add `DryRunOption` interface --- pr-checks/config.ts | 6 ++++++ pr-checks/update-release-branch.ts | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/pr-checks/config.ts b/pr-checks/config.ts index c51c56bff..3c14ca1db 100644 --- a/pr-checks/config.ts +++ b/pr-checks/config.ts @@ -36,3 +36,9 @@ export const API_COMPATIBILITY_FILE = path.join( SOURCE_ROOT, "api-compatibility.json", ); + +/** A common interface for operations that support dry runs. */ +export interface DryRunOption { + /** A value indicating whether to perform operations with side effects. */ + dryRun?: boolean; +} diff --git a/pr-checks/update-release-branch.ts b/pr-checks/update-release-branch.ts index b80afee7b..0fda12ad2 100755 --- a/pr-checks/update-release-branch.ts +++ b/pr-checks/update-release-branch.ts @@ -23,7 +23,12 @@ import * as fs from "node:fs"; import { parseArgs } from "node:util"; import { type ApiClient, getApiClient } from "./api-client"; -import { CHANGELOG_FILE, PACKAGE_JSON, REPO_ROOT } from "./config"; +import { + CHANGELOG_FILE, + DryRunOption, + PACKAGE_JSON, + REPO_ROOT, +} from "./config"; /** Placeholder changelog content for a new release. */ const EMPTY_CHANGELOG = `# CodeQL Action Changelog @@ -70,10 +75,7 @@ export function getGitHubToken(): string { } /** Options for {@link runCommand}. */ -export interface RunCommandOptions { - /** A value indicating whether to just log the command, rather than run it. */ - dryRun?: boolean; - +export interface RunCommandOptions extends DryRunOption { /** Options for `execFileSync`. */ execOptions?: ExecFileSyncOptions; } @@ -107,11 +109,9 @@ export function runCommand( } /** Options for {@link runGit}. */ -export interface RunGitOptions { +export interface RunGitOptions extends DryRunOption { /** When true, non-zero exit codes will not throw. */ allowNonZeroExitCode?: boolean; - /** A value indicating whether to just log the command, rather than run it. */ - dryRun?: boolean; } /**