Skip to main content

Overview

Badge endpoints generate dynamic SVG badges that can be embedded in README files to signal support for anonymous contributions or display PR statistics.

GET /badges/:badge

Serve static badges for signaling anonymous contributor support.

Parameters

string
required
Badge type identifier:
  • anonymous-friendly.svg - Static “Anonymous Contributor Friendly” badge
  • deployed.svg - Shows current deployment commit hash

Anonymous Friendly Badge

Static Version

Displays a generic “Anonymous Contributor Friendly” badge.

Dynamic Verified Version

For repositories with a .gitgost.yml file, include the repo query parameter to show verified status:

Query Parameters

string
Repository in owner/repo format (URL-encoded). If provided and a .gitgost.yml file exists, the badge shows verified status in green. If the file doesn’t exist, it shows gray.

Response

  • Content-Type: image/svg+xml
  • Format: SVG badge with appropriate styling
  • Color: Green (#4CAF50) for verified repos, Gray (#9E9E9E) for unverified

Deployed Badge

Shows the currently deployed commit hash or service status.

Query Parameters

string
Optional commit hash to display. Defaults to currently deployed commit. Automatically truncated to 7 characters.

Response

  • Content-Type: image/svg+xml
  • Cache-Control: public, max-age=3600
  • Color: Blue (#0ea5e9) when active, Red (#e05d44) when suspended

Service States

GET /badge/:owner/:repo

Generate a dynamic badge showing the count of anonymous PRs created for a specific repository.

Parameters

string
required
GitHub repository owner (alphanumeric, hyphens, underscores, dots)
string
required
Repository name (alphanumeric, hyphens, underscores, dots)

Request

Response

  • Content-Type: image/svg+xml
  • Cache-Control: public, max-age=300 (5 minutes)
  • Format: Shields.io-compatible SVG badge
  • Label: “Anonymous PRs”
  • Value: PR count (integer)
  • Color: Green (#4CAF50)

Response Example

Caching Behavior

  • Internal cache TTL: 5 minutes
  • HTTP cache header: 5 minutes
  • Automatically refreshes on cache expiry
  • Falls back to last known value on database errors

Error Responses

Invalid Repository Name

HTTP Status: 400 Bad Request Validation rules:
  • Length: 1-100 characters
  • Allowed: alphanumeric, -, _, .
  • Forbidden: .., /, path traversal attempts

Embedding Examples

Full Repository Badge Set

Verification Badge Setup

To enable the verified badge (green status), add a .gitgost.yml file to your repository root:
.gitgost.yml
Then use the dynamic badge with the repo parameter:

Implementation Reference

Source: internal/http/handlers.go
  • BadgeHandler (lines 1417-1433)
  • serveAnonymousFriendlyBadge (lines 1482-1502)
  • serveDeployedBadge (lines 1504-1561)
  • serveSuspendedBadge (lines 1435-1480)
  • BadgePRCountHandler (lines 1571-1653)
  • Badge cache implementation (lines 1563-1569)
Router configuration: internal/http/router.go (lines 147-149)