1
0
mirror of synced 2025-12-22 11:26:57 -05:00

workflow_dispatch version input for sync search (#32207)

This commit is contained in:
Peter Bengtsson
2022-11-01 21:24:58 +01:00
committed by GitHub
parent fe491f1cda
commit 96ae1fa44d
2 changed files with 44 additions and 2 deletions

View File

@@ -137,12 +137,40 @@ async function main(opts, args) {
async function indexAll(node, sourceDirectory, opts) {
const client = new Client({ node })
const { version, language, verbose, notLanguage, indexPrefix } = opts
const { language, verbose, notLanguage, indexPrefix } = opts
let version
if ('version' in opts) {
version = opts.version
if (process.env.VERSION) {
console.warn(
`'version' specified as argument ('${version}') AND environment variable ('${process.env.VERSION}')`
)
}
} else {
if (process.env.VERSION && process.env.VERSION !== 'all') {
version = process.env.VERSION
if (!allVersionKeys.includes(version)) {
throw new Error(
`Environment variable 'VERSION' (${version}) is not recognized. Must be one of ${allVersionKeys}`
)
}
}
}
let versionKeys = allVersionKeys
// If it came from the `--version` argument parsing, it might be a string
// or an array of strings because it uses `--version [VERSION...]`.
if (version) {
if (Array.isArray(version)) {
versionKeys = version
} else {
versionKeys = [version]
}
}
// This will throw if it can't ping
await client.ping()
const versionKeys = version || allVersionKeys
const languages =
language || languageKeys.filter((lang) => !notLanguage || !notLanguage.includes(lang))
if (verbose) {