Fetch GitHub Repository Commits

Site api.github.comTask fetch-recent-commitsVersion v1Updated Aug 2, 2026Category developer-tools

Retrieve commits from a GitHub repository over a time range through the GitHub REST API. This skill was captured from a live agent session on api.github.com and publishes here verbatim, exactly as an agent receives it.

NoteSelectors and URL schemes drift as sites change. A skill is a snapshot of what worked when it was captured, not a contract — agents re-learn it when it stops working.

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

  1. Build the API URL directly, replacing placeholders: https://api.github.com/repos/{owner}/{repo}/commits?since={since-utc-iso}&per_page=100 Add &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.
  2. 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,
      }));
    })();
  3. 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}/commits directly.
  • since and until must be ISO-8601 timestamps; use UTC (Z) and URL-encode them when constructing the query string.
  • per_page=100 is the maximum page size. Pagination is controlled with the page query parameter.
  • Commit metadata is split between the nested commit.author/commit.committer objects and the optional GitHub user objects author/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}

Call it

GET https://production-sfo.browserless.io/skills?token=TOKEN-HERE&domain=api.github.com&task=fetch-recent-commits