@yuki-no/plugin-batch-pr
Version:
Batch PR plugin for yuki-no - Collects opened Yuki-no translation issues and creates a single pull request
23 lines (22 loc) • 1.16 kB
JavaScript
import { formatError, log } from '@yuki-no/plugin-sdk/utils/log';
export const filterPendedTranslationIssues = async (github, translationIssues) => {
const pendedTranslationLabels = await getYukiNoReleaseTrackingLabels(github);
log('I', `filterPendedTranslationIssues :: Getting release tracking labels [${pendedTranslationLabels.join(', ')}]`);
return translationIssues.filter(({ labels }) => labels.every(l => !pendedTranslationLabels.includes(l)));
};
const getYukiNoReleaseTrackingLabels = async (github) => {
try {
const { getReleaseTrackingLabels } = await import(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
'@yuki-no/plugin-release-tracking/getReleaseTrackingLabels');
log('I', 'getYukiNoReleaseTrackingLabels :: use @yuki-no/plugin-release-tracking');
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return getReleaseTrackingLabels(github);
}
catch (error) {
log('I', `getYukiNoReleaseTrackingLabels :: cannot find @yuki-no/plugin-release-tracking / ${formatError(error)}`);
}
return [];
};