From 376a699478a3808fefe5ac36bbc8b6d37890cb09 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Fri, 26 Jan 2024 20:07:43 -0600 Subject: [PATCH] ci: allow api version on registry update scripts --- contributing/metadata.md | 2 ++ scripts/update-registry/update2.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contributing/metadata.md b/contributing/metadata.md index 5d733eaea3..03218254d5 100644 --- a/contributing/metadata.md +++ b/contributing/metadata.md @@ -35,6 +35,8 @@ The script will: yarn update-registry YourTypeNameHere ``` +You can set the environment variable `SF_ORG_API_VERSION` if you want to specify an API version. + ### What the script can't do inFolderTypes and types with childXml in their describe are not supported. You **want** to explore the various strategies for those (see the [SDR Handbook](../HANDBOOK.md) in this repo) and [create tests](#integration-testing) to validate that your types are being handled correctly. diff --git a/scripts/update-registry/update2.ts b/scripts/update-registry/update2.ts index 9d52d190c0..6b41d1a92a 100644 --- a/scripts/update-registry/update2.ts +++ b/scripts/update-registry/update2.ts @@ -7,6 +7,7 @@ import * as deepmerge from 'deepmerge'; import { CoverageObject, CoverageObjectType } from '../../src/registry/types'; import { getMissingTypes } from '../../test/utils/getMissingTypes'; import { getCurrentApiVersion, getCoverage } from '../../src/registry/coverage'; +import { env } from '@salesforce/kit'; export let metadataCoverage: CoverageObject; @@ -83,7 +84,7 @@ const registryUpdate = (missingTypesAsDescribeResult: DescribeResult[]) => { // get the coverage report (async () => { - const currentApiVersion = await getCurrentApiVersion(); + const currentApiVersion = env.getNumber('SF_ORG_API_VERSION') ?? (await getCurrentApiVersion()); console.log(`Using API version: ${currentApiVersion}`); const metadataCoverage = await getCoverage(currentApiVersion);