Skip to content

fix: implement pagination for workflow jobs fetching#188

Merged
paper2 merged 12 commits intomainfrom
fix/workflow-jobs-pagination
Feb 21, 2026
Merged

fix: implement pagination for workflow jobs fetching#188
paper2 merged 12 commits intomainfrom
fix/workflow-jobs-pagination

Conversation

@paper2
Copy link
Owner

@paper2 paper2 commented Feb 21, 2026

Fix workflow jobs pagination to support 100+ jobs

#185

Problem

The action was only fetching the first 100 jobs from workflows due to missing pagination support in the GitHub API call. Workflows with more than 100 jobs would have incomplete telemetry data, causing metrics and traces to be inaccurate.

Solution

  • Implemented pagination using octokit.paginate() to fetch all workflow jobs without artificial limits
  • Added comprehensive integration tests with a 200-job workflow to validate pagination behavior
  • Enhanced the reusable validation workflow with job count verification capabilities

Changes

Core Fix:

  • src/github/github.ts: Replaced single API call with paginated fetching using octokit.paginate()
  • Accepts the risk of potential memory issues for workflows with 1000+ jobs (documented in code comments)

Testing Infrastructure:

  • Added .github/workflows/test-many-jobs.yml: New test workflow with 200 jobs to validate pagination
  • Enhanced .github/workflows/validate-action-output.yml with:
    • Optional trace/metrics validation flags (validate-traces, validate-metrics)
    • Job count validation step with pattern matching support
    • Numeric validation for job count to prevent false positives
    • Improved error handling with set -euo pipefail

Test Organization:

  • Renamed workflows for clarity:
    • push-event-tests.ymltest-push-event.yml
    • workflow-run-tests.ymltest-workflow-run-validation.yml
    • workflow-run-tests-target-workflow.ymltest-workflow-run-event.yml

Documentation:

  • Updated README.md with OTLP endpoint configuration details
  • Added spec documentation in .kiro/specs/workflow-jobs-pagination-fix/

Testing

  • Unit tests updated to cover pagination scenarios
  • Integration test validates 200-job workflow successfully processes all jobs
  • Job count validation ensures telemetry completeness

- Replace direct API call with octokit.paginate() to fetch all jobs
- Add warning for workflows with >100 jobs about memory usage
- Update test mocks to include paginate method
- Fixes issue where only first 100 jobs were fetched from large workflows
- Add bugfix requirements document outlining pagination limitation and expected behavior
- Add design document with fault conditions, preservation requirements, and implementation approach
- Add tasks document with implementation steps and test requirements
- Add Kiro spec configuration for workflow-jobs-pagination-fix bugfix
- Update github.test.ts with pagination-related test cases
- Ensures complete job fetching for workflows exceeding 100 jobs limit
- Remove warning log requirements (2.5, 2.6) from bugfix specification
- Remove warning property validation from design specification
- Replace warning implementation with code comment documenting risk acceptance
- Update tasks to add explanatory comment instead of warning logic
- Document OOM error implications and future considerations in code
- Update test coverage to reflect simplified implementation (97.52%)
- Create target workflow with 200 matrix jobs to test pagination
- Create collector workflow to validate telemetry collection
- Workflows trigger on push to test pagination fix
- Collector verifies at least 200 job spans are captured
- Remove trailing whitespace from test-pagination-200-jobs-collector.yml
- Reformat task descriptions in tasks.md to improve readability and maintain consistent line length
- Improve documentation formatting for better maintainability
@paper2 paper2 force-pushed the fix/workflow-jobs-pagination branch from 608639e to 68c800d Compare February 21, 2026 04:23
…eters

- Delete redundant test-pagination-200-jobs-collector.yml workflow
- Rename test-pagination-200-jobs-target.yml to test-with-many-jobs.yml for clarity
- Simplify trigger conditions to push events without branch restrictions
- Add verification job that calls validate-action-output.yml reusable workflow
- Extend validate-action-output.yml with new input parameters for selective validation
- Add validate-traces, validate-metrics, validate-job-count, and expected-job-count inputs
- Update job naming and step structure for better readability
- Streamline workflow to use reusable workflow pattern instead of separate collector workflow
- Add `set -euo pipefail` to all shell script blocks for strict error handling
- Add `-r` flag to jq command in job count validation for raw output
- Normalize whitespace and line breaks for consistency across validation steps
- Improve script robustness by ensuring pipelines fail on any error and undefined variables are caught
… docs

- Remove trailing whitespace from validate-action-output.yml workflow file
- Add clarification to README about OpenTelemetry environment variable support
- Document that OTEL_ variables are automatically read from job steps
- Reference OpenTelemetry SDK environment variable specification for extended configuration options
- Improve documentation clarity for users configuring the action
@paper2 paper2 force-pushed the fix/workflow-jobs-pagination branch from 860da06 to c1a83f6 Compare February 21, 2026 05:51
@paper2 paper2 force-pushed the fix/workflow-jobs-pagination branch from 0a5764e to 22ae585 Compare February 21, 2026 07:01
@paper2 paper2 merged commit da0cf2c into main Feb 21, 2026
220 checks passed
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.

1 participant