Skip to content

[Code Quality] Fix workflow metrics collection showing zero compiled workflows #13162

@github-actions

Description

@github-actions

Description

The Daily Code Metrics Report (#13148) shows a data collection anomaly: the workflow metrics report 179 total workflow files but 0 compiled workflows and 0 average size, which is inconsistent with the 245,071 LOC in .github/workflows/ directory.

Current State

Workflow Metrics (From Feb 1, 2026 Report):

  • Total Workflow Files (.md): 179 files
  • Compiled Workflows (.lock.yml): 0 files ❌ (should be 148+)
  • Average Workflow Size: 0 lines ❌ (should be ~63 KB based on lockfile stats)

Known Reality (From lockfile stats #13125):

  • 148 compiled .lock.yml files exist
  • Average size: 63 KB (65,616 bytes)
  • Total size: 9.16 MB

Problem

The metrics collection code is not detecting compiled workflows correctly, likely due to:

  1. Wrong file path or glob pattern for .lock.yml files
  2. Incorrect parsing logic
  3. Missing error handling causing silent failures

Files Affected

  • pkg/metrics/collector.go or similar metrics collection code
  • Workflow metrics analysis script in .github/workflows/daily-code-metrics.md
  • Possibly scripts/analyze_code_metrics.sh if using shell scripts

Implementation Approach

  1. Find metrics collection code:

    grep -r "Compiled Workflows" pkg/ .github/workflows/
    grep -r "\.lock\.yml" pkg/metrics/ scripts/
  2. Debug workflow detection:

    • Check file path patterns (should match .github/workflows/*.lock.yml)
    • Verify file reading logic
    • Add debug logging to see what's being counted
  3. Fix detection logic:

    # Should find 148 files
    find .github/workflows -name "*.lock.yml" -type f | wc -l
  4. Test metrics collection:

    • Run metrics collection locally
    • Verify all counts are non-zero and accurate
    • Compare with lockfile stats analysis results

Success Criteria

  • Workflow metrics correctly count all .lock.yml files (~148)
  • Average workflow size is accurate (~63 KB)
  • Metrics align with lockfile statistics analysis
  • No zero values in workflow metrics section
  • Error handling added for metric collection failures

Impact

  • Severity: Low (incorrect reporting, not affecting functionality)
  • Scope: Daily code metrics reports
  • Benefit: Accurate metrics for monitoring codebase health and workflow growth

Source

Extracted from Discussion #13148 - Daily Code Metrics Report (Feb 1, 2026)

"Review Workflow Metrics Discrepancy: The workflow metrics show 179 total workflow files but 0 compiled workflows and 0 average size, which appears inconsistent with the 245,071 LOC in .github/workflows/. Investigate metric collection accuracy."

Priority

Medium - Affects visibility into codebase health, but not critical

Estimated Effort: 1-2 hours (debug + fix + test)

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 15, 2026, 9:07 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions