Purpose
Fetch and normalize commits for any GitHub repository, including commits from the last 24 hours or another caller-specified UTC time range.
When to Use
Use when the task requires repository commit history filtered by since, optionally bounded by until, with up to 100 commits per API response.
Workflow
- Build the API URL directly, replacing placeholders:
https://api.github.com/repos/{owner}/{repo}/commits?since={since-utc-iso}&per_page=100Add&until={until-utc-iso}when an upper bound is required. For the last 24 hours, set{since-utc-iso}to the current UTC time minus 24 hours. - Navigate to the URL and run this evaluator on the loaded API response in the same browser call:
(() => { const text = document.body.innerText.trim(); const data = JSON.parse(text); if (!Array.isArray(data)) { throw new Error(data.message || "GitHub commits response is not an array"); } return data.map((c) => ({ sha: c.sha, message: c.commit?.message ?? "", author: { name: c.commit?.author?.name ?? null, email: c.commit?.author?.email ?? null, date: c.commit?.author?.date ?? null, login: c.author?.login ?? null, }, committer: { name: c.commit?.committer?.name ?? null, email: c.commit?.committer?.email ?? null, date: c.commit?.committer?.date ?? null, login: c.committer?.login ?? null, }, url: c.html_url ?? null, })); })(); - If more than 100 matching commits are needed, request subsequent pages by adding
&page={page-number}and combine the extracted arrays; stop when a page returns fewer than 100 commits or no commits.
Site-Specific Gotchas
- The commits endpoint is a REST API URL, not a GitHub HTML repository page; use
/repos/{owner}/{repo}/commitsdirectly. sinceanduntilmust be ISO-8601 timestamps; use UTC (Z) and URL-encode them when constructing the query string.per_page=100is the maximum page size. Pagination is controlled with thepagequery parameter.- Commit metadata is split between the nested
commit.author/commit.committerobjects and the optional GitHub user objectsauthor/committer; either user object can be null for an unassociated email. - The evaluator assumes the loaded page is the JSON API response and intentionally fails clearly on GitHub error objects.
Expected Output
An array of objects shaped as:
{sha, message, author: {name, email, date, login}, committer: {name, email, date, login}, url}