[Tooling] Add requirements for translation contributors as options to script
This commit is contained in:
@@ -88,18 +88,32 @@ const creditRelevantActions = [
|
||||
WeblateChangeActions.MARKED_FOR_EDIT,
|
||||
];
|
||||
|
||||
const { afterDate, beforeDate } = yargs
|
||||
const { afterDate, beforeDate, requiredContributionCount, keepKnownContributors } = yargs
|
||||
.options({
|
||||
afterDate: {
|
||||
alias: 'ad',
|
||||
description: 'IS0-8601 formatted date (included) (e.g. 2024-05-01)',
|
||||
type: 'string',
|
||||
demandOption: true,
|
||||
},
|
||||
beforeDate: {
|
||||
alias: 'bd',
|
||||
description: 'IS0-8601 formatted date (excluded) (e.g. 2024-05-11)',
|
||||
type: 'string',
|
||||
demandOption: true,
|
||||
},
|
||||
requiredContributionCount: {
|
||||
alias: 'rcc',
|
||||
description: 'The minimum number of contributions for a language to be considered a contributor',
|
||||
type: 'number',
|
||||
default: 10,
|
||||
},
|
||||
keepKnownContributors: {
|
||||
alias: 'kc',
|
||||
description: 'Ignore "requiredContributionCount" for known contributors of a language',
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
})
|
||||
.parseSync();
|
||||
|
||||
@@ -334,7 +348,8 @@ const createTranslationChangelog = async (): Promise<void> => {
|
||||
([language, languageContributors]) => {
|
||||
const validContributors = languageContributors.filter(
|
||||
({ username, contributionCount }) =>
|
||||
knownContributorsByLanguage[language]?.includes(username) || contributionCount >= 10,
|
||||
(keepKnownContributors && knownContributorsByLanguage[language]?.includes(username)) ||
|
||||
contributionCount >= requiredContributionCount,
|
||||
);
|
||||
const contributors = validContributors.length ? validContributors : [languageContributors[0]];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user