Skip to content

Conversation

Copy link

Copilot AI commented Jan 6, 2026

GitHub changed their usage report CSV format from 15 columns (with workflow/username details) to 12 columns (summarized). The app failed when accessing date and other properties that were undefined due to incompatible parsing logic.

Changes

Custom CSV parser with format detection

  • Detects three formats: legacy-15, legacy-14, and summarized-12
  • Routes to format-specific parsers that handle column mapping correctly
  • Tracks format type and which fields are available (hasWorkflowData, hasUsernameData)

Type definitions

  • Moved UsageReport and UsageReportLine from external lib to internal definitions
  • Marked workflowName, workflowPath, username as optional to support all formats

UI adaptations

  • Hide/disable workflow and user grouping when data unavailable
  • Chart falls back to repository grouping when username missing
  • Display format notice for summarized reports

Example of the new parser:

function detectCsvFormat(headerLine: string): CsvFormat {
  const headers = headerLine.toLowerCase();
  const columnCount = headerLine.split(',').length;
  
  if (headers.includes('workflow_name')) return 'legacy-15';
  if (columnCount >= 14 && headers.includes('username')) return 'legacy-14';
  return 'summarized-12';
}

function parseSummarizedLine(csv: string[]): UsageReportLine {
  return {
    date: new Date(Date.parse(csv[0])),
    // ... 9 columns ...
    username: '',  // Not present in summarized format
    workflowName: undefined,
    workflowPath: undefined,
  };
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/github-actions-usage-report/github-actions-usage-report/node_modules/.bin/ng build -I odules/.bin/ng .egg (dns block)
  • www.google-analytics.com
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/github-actions-usage-report/github-actions-usage-report/node_modules/.bin/ng lint -I /home/REDACTED/.cache/node-gyp/20.19.6/deps/zlib -I /home/REDACTED/.cache/node-gyp/20.19.6/deps/v8/include -I ../../node-addon-api -I ../dependencies/lz4/lib -I (dns block)
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/github-actions-usage-report/github-actions-usage-report/node_modules/.bin/ng build -I odules/.bin/ng .egg (dns block)
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/github-actions-usage-report/github-actions-usage-report/node_modules/.bin/ng build --configuration development (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Problem

There is a bug in the report format causing the error: "Cannot read properties of undefined (reading 'date')" as reported in issue #89.

Solution

Apply the fix from the fork at https://github.com/korniychuk/github-actions-usage-report (main branch) which resolves this issue.

Details

  • The error occurs when processing the usage report data
  • A working fix has been implemented in korniychuk's fork
  • This PR should incorporate those changes to fix the undefined property access

Reference

Fixes #89

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@austenstone austenstone marked this pull request as ready for review January 6, 2026 14:34
Copilot AI and others added 2 commits January 6, 2026 14:47
- Add custom CSV parser with format detection (legacy-15, legacy-14, summarized-12)
- Add custom UsageReport and UsageReportLine types supporting optional fields
- Track format type and availability of workflow/username data
- Update usage.component to import types from service and handle format changes
- Update table-workflow-usage to handle missing username/workflow data gracefully
- Update chart-pie-user to fall back to repository grouping when username data unavailable
- Add UI indicators for summarized report format
- Disable workflow/user grouping options when data not available

Co-authored-by: austenstone <22425467+austenstone@users.noreply.github.com>
Co-authored-by: austenstone <22425467+austenstone@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix report format bug causing undefined property error Support new summarized CSV format to fix undefined property access Jan 6, 2026
Copilot AI requested a review from austenstone January 6, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Error: Cannot read properties of undefined (reading 'date') • Report format at 2026.01.06

2 participants