badges / badges/shields

Self-hosted Servers cannot support both v3 and v4 based badges with GitHub Enterprise Server

Open
#6,910 5 comments 0 reactions 0 assignees View on GitHub
service-badge
Dominant language
JavaScript
Stars
27.2k
Forks
5.6k
Avg merge
1d 8h
Merged PRs (30d)
46

Description

### Discussed in https://github.com/badges/shields/discussions/6909

TL;DR, GitHub uses different API routes for their cloud/SaaS products and their Server/self-hosted Product:

Cloud/SaaS:
v3: https://api.github.com/{api-path}/{params}
v4: https://api.github.com/graphql/{api-path}/{params}

Enterprise Server:
v3: https://server/api/v3/{api-path}/{params}
v4: https://server/api/graphql/{api-path}/{params}

The way we wired up the paths for the various GitHub pages is coded to the Cloud/SaaS model, which in turn forces self-hosted Shields users to essentially have to pick either the v3 or the v4 badges in a mutually exclusive way (i.e. set `GITHUB_URL=https://server/api/v3` if you want the v3 based badges and no v4 badges, or `GITHUB_URL=https://server/api/` for the opposite)

Originally posted by **ericscheidemantle-dreamworks** August 18, 2021
I've found and successfully set my `GITHUB_URL` but have yet to figure out how to handle the fact that the REST API uses /api/v3 but the GRAPHQL doesn't. If I set `GITHUB_URL` to https://myserver/api/v3, some end points like `/github/last-commit/:user/:repo` work fine, but ones using /graphql, like `/github/issues-pr/:user/:repo` fail because an invalid URL is constructed.

Is there a configuration option to solve this?

Contributor guide

Open the contributing guide

Research direction

Start by tracing how GitHub REST and GraphQL endpoint URLs are constructed from GITHUB_URL for the affected badge paths. Confirm the behavior for both GitHub Enterprise Server forms, including the v3 REST and /api/graphql routes; done means v3- and v4-based badges work together with one configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.