Skip to content

Fix incorrect handling of non-paginated repositories in fetchFirstCommitDate function#17

Open
haya08 wants to merge 1 commit intojson-schema-org:mainfrom
haya08:main
Open

Fix incorrect handling of non-paginated repositories in fetchFirstCommitDate function#17
haya08 wants to merge 1 commit intojson-schema-org:mainfrom
haya08:main

Conversation

@haya08
Copy link

@haya08 haya08 commented Feb 13, 2026

Description

This PR fixes a logic issue in fetchFirstCommitDate function where repositories without pagination (i.e., repositories whose commits fit within a single page) were not handled correctly.

Problem

In the previous implementation, when the Link header was absent (indicating no pagination), the function accessed the commit date but did not return it:
response.data[0].commit.author.date;

Solution

The updated implementation:

  • Explicitly returns the commit date when pagination is not present.
  • Stops execution early in the single-page case.
  • Ensures empty repositories are handled properly.
  • Preserves the original error message to improve debugging.

This guarantees correct behavior for:

  • Empty repositories
  • Single-page repositories
  • Multi-page repositories

Impact

This change improves the reliability of first commit date extraction and prevents false failures when processing repositories without pagination.

@haya08
Copy link
Author

haya08 commented Feb 15, 2026

@Relequestual can you please review this

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