MCPcopy Create free account
hub / github.com/github/awesome-copilot / pluginsMatch

Function pluginsMatch

eng/external-plugin-approval.mjs:78–102  ·  view source on GitHub ↗
(left, right)

Source from the content-addressed store, hash-verified

76}
77
78function pluginsMatch(left, right) {
79 const leftName = normalizeValue(left?.name);
80 const rightName = normalizeValue(right?.name);
81 const leftRepo = normalizeValue(left?.source?.repo);
82 const rightRepo = normalizeValue(right?.source?.repo);
83 const leftPath = normalizePathValue(left?.source?.path);
84 const rightPath = normalizePathValue(right?.source?.path);
85 const leftRepository = normalizeRepositoryUrl(left?.repository);
86 const rightRepository = normalizeRepositoryUrl(right?.repository);
87
88 if (leftName && rightName && leftName === rightName) {
89 return true;
90 }
91
92 const repoMatches = leftRepo && rightRepo && leftRepo === rightRepo;
93 const repositoryMatches = leftRepository && rightRepository && leftRepository === rightRepository;
94 const pathKnown = Boolean(leftPath || rightPath);
95 const pathMatches = leftPath === rightPath;
96
97 if ((repoMatches || repositoryMatches) && pathKnown && pathMatches) {
98 return true;
99 }
100
101 return false;
102}
103
104export function upsertExternalPlugin(plugin, { filePath = EXTERNAL_PLUGINS_FILE } = {}) {
105 const { plugins, errors } = readExternalPlugins({

Callers 1

upsertExternalPluginFunction · 0.85

Calls 3

normalizeValueFunction · 0.70
normalizePathValueFunction · 0.70
normalizeRepositoryUrlFunction · 0.70

Tested by

no test coverage detected