[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,
|
WeblateChangeActions.MARKED_FOR_EDIT,
|
||||||
];
|
];
|
||||||
|
|
||||||
const { afterDate, beforeDate } = yargs
|
const { afterDate, beforeDate, requiredContributionCount, keepKnownContributors } = yargs
|
||||||
.options({
|
.options({
|
||||||
afterDate: {
|
afterDate: {
|
||||||
|
alias: 'ad',
|
||||||
description: 'IS0-8601 formatted date (included) (e.g. 2024-05-01)',
|
description: 'IS0-8601 formatted date (included) (e.g. 2024-05-01)',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
},
|
},
|
||||||
beforeDate: {
|
beforeDate: {
|
||||||
|
alias: 'bd',
|
||||||
description: 'IS0-8601 formatted date (excluded) (e.g. 2024-05-11)',
|
description: 'IS0-8601 formatted date (excluded) (e.g. 2024-05-11)',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
demandOption: true,
|
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();
|
.parseSync();
|
||||||
|
|
||||||
@@ -334,7 +348,8 @@ const createTranslationChangelog = async (): Promise<void> => {
|
|||||||
([language, languageContributors]) => {
|
([language, languageContributors]) => {
|
||||||
const validContributors = languageContributors.filter(
|
const validContributors = languageContributors.filter(
|
||||||
({ username, contributionCount }) =>
|
({ username, contributionCount }) =>
|
||||||
knownContributorsByLanguage[language]?.includes(username) || contributionCount >= 10,
|
(keepKnownContributors && knownContributorsByLanguage[language]?.includes(username)) ||
|
||||||
|
contributionCount >= requiredContributionCount,
|
||||||
);
|
);
|
||||||
const contributors = validContributors.length ? validContributors : [languageContributors[0]];
|
const contributors = validContributors.length ? validContributors : [languageContributors[0]];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user