workflow_dispatch version input for sync search (#32207)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user