Skip to content

[duplicate-code] Duplicate Code: Skip Gate Mirror Logic #43478

Description

@github-actions

🔍 Duplicate Code Detected: Skip Gate Mirror Logic

Analysis of commit bd0c249

Assignee: @copilot

Summary

check_skip_if_match.cjs and check_skip_if_no_match.cjs implement the same 47-line gate with only threshold direction and output/message names changed.

Duplication Details

Pattern: mirror-image skip query gate

  • Severity: High
  • Occurrences: 2
  • Locations:
    • actions/setup/js/check_skip_if_match.cjs (lines 9-54)
    • actions/setup/js/check_skip_if_no_match.cjs (lines 9-54)
  • Code Sample:
    const searchQuery = buildSearchQuery(skipQuery, skipScope);
    const { data: { total_count: totalCount } } = await github.rest.search.issuesAndPullRequests({ q: searchQuery, per_page: 1 });
    if (totalCount >= maxMatches) { ... }

Impact Analysis

  • Maintainability: Threshold parsing, validation, search execution, and denial reporting must be fixed in two places.
  • Bug Risk: Any change to search behavior or summary text can drift between the two gates.
  • Code Bloat: Nearly identical control flow is duplicated across sibling workflow guards.

Refactoring Recommendations

  1. Extract a shared runSkipQueryGate helper that accepts comparator, threshold name, output key, and message template.
  2. Keep only the policy-specific wrapper in each file.

Analysis Metadata

  • Analyzed Files: 2
  • Detection Method: Serena semantic code analysis
  • Commit: bd0c249

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by 🔍 Duplicate Code Detector · 13 AIC · ⌖ 6.29 AIC · ⊞ 13.3K ·

  • expires on Jul 6, 2026, 10:33 PM UTC-08:00

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions