export function getSuitableReposWithoutWorkflows()

in packages/repocop/src/remediation/dependency_graph-integrator/send-to-sns.ts [143:181]


export function getSuitableReposWithoutWorkflows(
	languages: github_languages[],
	productionRepos: Repository[],
	productionWorkflowUsages: guardian_github_actions_usage[],
	exemptedCustomProperties: github_repository_custom_properties[],
): RepositoryWithDepGraphLanguage[] {
	const depGraphLanguages: DepGraphLanguage[] = ['Scala', 'Kotlin'];

	const allReposWithoutWorkflows: RepositoryWithDepGraphLanguage[] =
		depGraphLanguages.flatMap((language) => {
			const reposWithDepGraphLanguages: Repository[] = productionRepos.filter(
				(repo) => checkRepoForLanguage(repo, languages, language),
			);
			console.log(
				`Found ${reposWithDepGraphLanguages.length} ${language} repos in production`,
			);

			return reposWithDepGraphLanguages
				.filter(
					(repo) => !repoIsExempted(repo, exemptedCustomProperties, language),
				)
				.filter((repo) => {
					const workflowUsagesForRepo = productionWorkflowUsages.filter(
						(workflow) => workflow.full_name === repo.full_name,
					);
					return !doesRepoHaveDepSubmissionWorkflowForLanguage(
						repo,
						workflowUsagesForRepo,
						language,
					);
				})
				.map((repo) => ({ ...repo, dependency_graph_language: language }));
		});

	console.log(
		`Found ${allReposWithoutWorkflows.length} production repos without dependency submission workflows`,
	);
	return allReposWithoutWorkflows;
}