diff --git a/.env.example b/.env.example index 0d64fcba..972ef615 100644 --- a/.env.example +++ b/.env.example @@ -16,4 +16,6 @@ MANAGER_DOWNLOADERS_ASSET_REGEX=apk$ CONTRIBUTORS_REPOS=revanced-manager:ReVanced Manager,revanced-patches:ReVanced Patches,revanced-cli:ReVanced CLI,revanced-documentation:ReVanced Documentation,revanced-website:ReVanced Website,revanced-patcher:ReVanced Patcher,revanced-api:ReVanced API,revanced-manager-downloaders:ReVanced Manager Downloaders,revanced-bots:ReVanced Bots,revanced-library:ReVanced Library,revanced-patches-gradle-plugin:ReVanced Patches Gradle Plugin,revanced-patches-template:ReVanced Patches Template,revanced-cloudflare-email-worker:ReVanced Cloudflare Email Worker,revanced-encrypt:ReVanced Encrypt,revanced-vote:ReVanced Vote,revanced-invoice:ReVanced Invoice,revanced-manager-downloaders-template:ReVanced Manager Downloaders Template,revanced-branding:ReVanced Branding +IGNORED_CONTRIBUTORS=semantic-release-bot,revanced-bot,dependabot[bot],github-actions[bot],pre-commit-ci[bot] + API_VERSION=5 diff --git a/src/config.ts b/src/config.ts index 66af8ce8..30a98407 100644 --- a/src/config.ts +++ b/src/config.ts @@ -16,6 +16,7 @@ export interface Config { downloadersAssetRegex: RegExp; }; contributorRepos: { repo: string; name: string }[]; + ignoredContributors: string[]; apiVersion: string; } @@ -42,6 +43,7 @@ export function getConfig(env: Env): Config { const [repo, ...nameParts] = entry.trim().split(':'); return { repo: repo.trim(), name: nameParts.join(':').trim() }; }), + ignoredContributors: env.IGNORED_CONTRIBUTORS.split(",").map((entry) => entry.trim()), apiVersion: env.API_VERSION }); } diff --git a/src/services/contributors.ts b/src/services/contributors.ts index b8e99a7d..a453c172 100644 --- a/src/services/contributors.ts +++ b/src/services/contributors.ts @@ -3,7 +3,7 @@ import type { Env } from '../types'; export async function getContributors(env: Env) { const backend = getBackend(env); - const { organization, contributorRepos } = getConfig(env); + const { organization, contributorRepos, ignoredContributors } = getConfig(env); const results = await Promise.all( contributorRepos.map(async ({ repo, name }) => { @@ -11,7 +11,9 @@ export async function getContributors(env: Env) { return { name, url: backend.repositoryUrl(organization, repo), - contributors: contributors.map((contributor) => ({ + contributors: contributors + .filter((contributor) => !ignoredContributors.includes(contributor.name)) + .map((contributor) => ({ name: contributor.name, avatar_url: contributor.avatarUrl, url: contributor.url, diff --git a/src/types.ts b/src/types.ts index e0052e08..5afccbde 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,5 +18,6 @@ export interface Env { MANAGER_DOWNLOADERS_ASSET_REGEX: string; PATCHES_PUBLIC_KEY_FILE: string; CONTRIBUTORS_REPOS: string; + IGNORED_CONTRIBUTORS: string; API_VERSION: string; }