Unpacking GitHub API Inconsistencies: Why Your Development Stats Might Be Misleading
GitHub API Discrepancy: When Your Repository's Health Score Doesn't Match Its Data
In the world of software development, accurate data is paramount for setting engineering team goals examples and tracking development stats. A recent discussion on GitHub's community forum highlights a significant inconsistency that could lead to misleading repository health metrics and skewed performance insights. Developer jmrplens brought to light a discrepancy where GitHub's Community Profile page reports a repository as 100% complete with issue templates, while its own REST and GraphQL APIs indicate the complete opposite.
The Core Discrepancy: UI vs. API
The issue centers on how GitHub detects and reports the presence of issue templates. When a repository, such as jmrplens/gitlab-mcp-server, uses the recommended YAML issue forms located under .github/ISSUE_TEMPLATE/, the repository's community profile page proudly displays a green checkmark for "Issue templates" and a perfect 100% health score. However, querying this same repository via GitHub's APIs yields surprising results:
- The REST API endpoint
GET /repos/{owner}/{repo}/community/profilereturns"files": { "issue_template": null }. - The GraphQL API query for
Repository.issueTemplatesreturns an empty array[].
This means that while the user interface signals full compliance and excellent development stats regarding template presence, the programmatic interface used by automated tools and integrations suggests a complete absence.
API Breakdown: What's Not Being Reported
Further investigation by jmrplens revealed specific patterns in the API's behavior:
- REST API (
files.issue_template): This field is only non-null for repositories using the legacy single file.github/ISSUE_TEMPLATE.md. If templates are organized in a directory (whether Markdown or YAML forms), the API reportsnull, despite the community page counting them towards the 100% score. - GraphQL API (
Repository.issueTemplates): This API correctly lists Markdown templates found in a directory (e.g.,cli/cli). However, it fails to include YAML issue forms (the recommended format) and also misses the legacy single file template.
This creates a fragmented view of repository health, making it challenging to establish consistent engineering performance goals examples based on API-driven metrics.
Why This Matters for Development Stats and Performance
The implications of this API inconsistency are significant. Any automated system or script designed to monitor repository health, track development stats, or enforce standards based on GitHub's APIs will inaccurately conclude that repositories using modern issue forms lack templates. This directly impacts the reliability of metrics used for:
- Automated compliance checks.
- Dashboard reporting on repository completeness.
- Tools that generate documentation or onboarding materials.
The only current workaround is to manually list the contents of the .github/ISSUE_TEMPLATE/ directory using the contents API or a GraphQL Tree query, which adds unnecessary complexity to developer workflows.
Code Examples Demonstrating the Issue
Here's how the APIs respond to a repository with YAML issue forms:
REST API Example:
curl -s -H "Authorization: Bearer $TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/jmrplens/gitlab-mcp-server/community/profile \
| jq '{health_percentage, issue_template: .files.issue_template}'{
"health_percentage": 100,
"issue_template": null
}GraphQL API Example:
{
repository(owner: "jmrplens", name: "gitlab-mcp-server") {
issueTemplates {
name
filename
}
}
}{
"data": {
"repository": {
"issueTemplates": []
}
}
}Proposed Solutions for API Alignment
To resolve these inconsistencies and ensure accurate development stats, jmrplens suggests:
- For the REST API: Update the
files.issue_templatefield to reflect the same detection logic used by the community page andhealth_percentage, recognizing directories of templates. Alternatively, clearly document that the field only reports the single legacy file. - For the GraphQL API: Expand
Repository.issueTemplatesto include YAML issue forms and the legacy single file, providing a comprehensive view of all template types.
Aligning these APIs with the UI's understanding of repository completeness is crucial for developers relying on programmatic access to GitHub data. It will ensure that development stats and repository health scores accurately reflect the effort teams put into maintaining well-documented and accessible contribution guidelines.
