How GitHub Usernames Are Extracted from Resume Profiles in the Hiring Agent

The interviewstreet/hiring-agent extracts GitHub usernames by scanning resume profile objects for network entries labeled "github", then parsing the URL with regex patterns in github.py to isolate the username before writing it to a CSV field.

The interviewstreet/hiring-agent repository processes JSON Resume files to automate technical candidate screening. A critical step in this pipeline involves identifying GitHub profile URLs within the resume's profiles section and extracting clean usernames for downstream analysis. This process relies on coordinated logic between transform.py and github.py to normalize URLs and apply pattern matching.

Profile Discovery in transform.py

The extraction pipeline begins in transform.py where the fetch_profile helper function traverses the list of profile objects from the resume's basics.profiles section. Each profile contains a network name and a url. When the function identifies a profile whose network field matches "github", it triggers the extraction workflow.

At lines 544-545, the resolved username is assigned to the CSV output row:

csv_row["github_username"] = (
    github_profile.username if github_profile.username else ""
)

This ensures that downstream evaluation modules receive a standardized string value, defaulting to empty if no username is found.

Username Extraction Logic in github.py

The actual parsing occurs in github.py within the extract_github_username function (lines 124-129). This utility first sanitizes the input URL by removing whitespace, then iterates through two regex patterns to locate the username segment.

def extract_github_username(github_url: str) -> Optional[str]:
    if not github_url:
        return None
    github_url = github_url.replace(" ", "").strip()
    patterns = [
        r"https?://github\.com/([^/]+)",
        r"github\.com/([^/]+)",
    ]
    for pattern in patterns:
        match = re.search(pattern, github_url)
        if match:
            return match.group(1)
    return None

The function returns the first captured group from the matching pattern, or None if the URL format is unrecognized.

Regex Pattern Analysis

The extraction logic employs two complementary patterns to handle URL variations:

  • r"https?://github\.com/([^/]+)" — Matches standard URLs with optional HTTP or HTTPS protocols, capturing the first path segment as the username.
  • r"github\.com/([^/]+)" — Matches domain-only references without protocol prefixes.

Both patterns use re.search to locate the match and ([^/]+) to capture the username while stopping at the next forward slash. This prevents trailing paths (such as /repos or /projects) from polluting the extracted value.

Summary

  • Profile Scanning: The fetch_profile function in transform.py identifies GitHub entries by matching the network field against "github".
  • URL Normalization: extract_github_username strips all whitespace and applies .strip() before regex evaluation.
  • Regex Extraction: Two patterns handle both protocol-prefixed (https://) and bare domain URLs, capturing only the first path segment as the username.
  • CSV Output: The extracted value is stored in the github_username column, with empty strings used for failed extractions.

Frequently Asked Questions

What happens if a resume lists multiple GitHub profiles?

The fetch_profile function processes the first profile entry where the network field matches "github". Subsequent GitHub URLs in the same resume are ignored, ensuring only one username is extracted per candidate.

How does the extractor handle HTTP versus HTTPS URLs?

The regex pattern r"https?://github\.com/([^/]+)" uses the optional quantifier ? to match both protocols. This ensures extraction succeeds whether the resume contains http://github.com/username or https://github.com/username.

What if the GitHub URL contains additional path segments?

The regex ([^/]+) captures only the first path segment after github.com/ and stops at the next forward slash. For example, https://github.com/jane-doe/repos correctly extracts only "jane-doe", ignoring the /repos suffix.

Where is the extracted username stored in the output?

According to transform.py lines 544-545, the username is written to the github_username column in the generated CSV row. If extraction fails or returns None, the field is populated with an empty string.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →