Skip to content

[daily] refactor: hoist knownPlugins to module-level KNOWN_PROW_PLUGINS constant - #112

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/deduplicate-known-prow-plugins-009c974cf1dbfbbd
Draft

[daily] refactor: hoist knownPlugins to module-level KNOWN_PROW_PLUGINS constant#112
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/deduplicate-known-prow-plugins-009c974cf1dbfbbd

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

What changed and why

background.js contained two identical local const knownPlugins declarations — one in extractOrgPlugins() and one in extractPlugins() — with a comment warning both copies must stay in sync with prow-plugin-map.js. This was a latent bug: adding a plugin to the map required remembering to update two separate arrays.

Change

Moved the list to a single module-level constant KNOWN_PROW_PLUGINS and updated both functions to reference it. The "must stay in sync with prow-plugin-map.js" note is preserved on the single declaration.

+const KNOWN_PROW_PLUGINS = [
+  'approve', 'lgtm', 'hold', 'trigger', 'assign', 'lifecycle',
+  'label', 'milestone', 'override', 'wip', 'retitle', 'cherrypick'
+];

extractOrgPlugins and extractPlugins each now iterate over KNOWN_PROW_PLUGINS instead of their own locally-scoped copy.

Testing

All 152 unit tests pass (npm test).

Generated by Daily Repository Improvement · ● 21.4M ·

The plugin name list used in extractPlugins() and extractOrgPlugins()
was defined twice as an identical local const, with a comment warning
the two copies must stay in sync.

Move the list to a single module-level constant (KNOWN_PROW_PLUGINS)
and reference it from both functions. The comment clarifying that it
must match prow-plugin-map.js is preserved on the module-level
declaration.

All 152 unit tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants