Skip to content

Commit

Permalink
refactor: check custom property language value
Browse files Browse the repository at this point in the history
  • Loading branch information
tjsilver committed Jan 10, 2025
1 parent 8ac2514 commit 2e82f09
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,19 @@ async function sendOneRepoToDepGraphIntegrator(

export function repoIsExempted(
repo: Repository,
exceptedCustomProperties: github_repository_custom_properties[],
exemptedCustomProperties: github_repository_custom_properties[],
language: DepGraphLanguage,
): boolean {
const repoIsExcepted = exceptedCustomProperties.find(
const exemptedRepo = exemptedCustomProperties.find(
(property) => repo.id === property.repository_id,
);
if (repoIsExcepted) {
if (exemptedRepo && exemptedRepo.value === language) {
logger.log({
message: `${repo.name} is excepted from dependency graph integration`,
numExceptedCustomProperties: exceptedCustomProperties.length,
message: `${repo.name} is exempted from dependency graph integration for ${language}`,
numexemptedCustomProperties: exemptedCustomProperties.length,
});
}
return repoIsExcepted !== undefined;
return exemptedRepo !== undefined;
}

export function getSuitableReposWithoutWorkflows(
Expand All @@ -155,7 +156,9 @@ export function getSuitableReposWithoutWorkflows(
);

return reposWithDepGraphLanguages
.filter((repo) => !repoIsExempted(repo, exemptedCustomProperties))
.filter(
(repo) => !repoIsExempted(repo, exemptedCustomProperties, language),
)
.filter((repo) => {
const workflowUsagesForRepo = productionWorkflowUsages.filter(
(workflow) => workflow.full_name === repo.full_name,
Expand Down

0 comments on commit 2e82f09

Please sign in to comment.