Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | //@ts-check import { some, upperFirst } from 'lodash-es'; import path from 'node:path'; import * as utils from '../src/utils.js'; import { fileURLToPath } from 'node:url'; const service = path.basename(fileURLToPath(import.meta.url)); /** * @param {GitConfig.Env} env * @param {GitConfig.$ProjectSchema} project * @param {GitConfig.Settings} settings */ export async function update(env, project, settings) { if (utils.isIgnored(env, project, settings, upperFirst(service))) { return; } env.spin.start(`Fetching .gitmodules file: ${project.name}`); return await env.gitlab.RepositoryFiles.showRaw(project.id, '.gitmodules', project.default_branch) .then( async () => { const vars = await env.gitlab.ProjectVariables.all(project.id); if (some(vars, { key: 'GIT_SUBMODULE_STRATEGY', value: 'recursive' })) { env.spin.debug(`${upperFirst(service)} already up-to-date: ${project.name}`); } else if (env.opts.dryRun) { env.spin.warn(`${upperFirst(service)} update required: ${project.name}`); } else { await env.gitlab.ProjectVariables.create(project.id, 'GIT_SUBMODULE_STRATEGY', 'recursive', { variableType: 'env_var' }); env.spin.succeed(`${upperFirst(service)} updated: ${project.name}`); } }, () => env.spin.debug(`${upperFirst(service)} no submodules: ${project.name}`) ); } export default update; |