Badge Request: GitHub projects
:clipboard: Description
I sow there's the GitHub's milestone completion badge #1209 , and it's a pretty cool one. But i was wondering about a GitHub's project badge.
something like
-
projectname | 42%cards completed for the whole project (might be of a green color) -
projectname | 3 in progresscards in progress, might have a purple background similiar to github's projects colors. -
projectname | 8 columnNameorprojectname | columnName 7/10cards completed in a single column -
bug triage | 5 in reviewthe number of cards could go before the name, it reads better imo.
or generally inspired by the milestone's ones, since projects and milestones are similiar.
Examples with static badges
:link: Data
There are GitHub's APIs. I think for public repos it doesn't require an API key. https://developer.github.com/v3/projects/
:microphone: Motivation
It would be nice for those who manage progress using github's projects.
I would like to be assigned to and work on this issue please 👍
Excellent, thanks @puf17640! We've got a great tutorial that walks through the process of creating a new badge, and you can ping us here and/or on Discord with any questions
Can you assign this issue to me.. I have worked with REST api so it will be easy for me to handle api
@calebcartwright @chris48s I'm working on this issue. But I have some questions.
Information related to projects requires github access token. So can you please tell me how to deal with that? How am I supposed to take the access token from the user via shields API?
I have explored the code base and found something like GithubAuthV3Service. Do I just need to inherit my GithubProjects class from GithubAuthV3Service?
There is also GithubAuthV4Service but that is for graphQL API. But here I am dealing with REST APIs.
I have read server-secrets.md, its telling to define token in env vairaibles but aren't this for local setup? How individual users are going to get their badge just by using the shields URL which I will be creating for this issue?
OK, so there's a few things here. Since this issue was opened 5 years ago some things have changed.
Firstly if I look at say https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28#list-organization-projects or https://docs.github.com/en/rest/projects/cards?apiVersion=2022-11-28#get-a-project-card it tells me
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience.
There's more info at https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/
We will not add a badge which relies on an API that deprecated and due for removal.
So we need to be looking at the ProjectV2 API which is available through the GraphQL v4 API
https://docs.github.com/en/graphql/reference/objects#projectv2
That will mean your base class should be GithubAuthV4Service
In terms of auth: Any data point we access needs to be something we can read with only the public_repo scope so the first thing we need to check is that any data relating to this feature that we need from the GitHub API can be accessed with that. If we need the read:project scope, this one is blocked.
The way the auth works is:
In local dev, you can just set a single token in an env var.
In production, we have a pool of many tokens. This blog post explains how it works https://shields.io/blog/token-pool
but for local dev, you don't need to run a token pool. You can just set a single token with public_repo scope.
We don't allow github badges that require individual users to expose a token in the badge URL.
I think the first thing here is to test if the ProjectV2 GraphQL API exposes data for public projects if we authenticate with a token that does not have read:project. Does anyone have an example of a public v2 project we can look at. It is a GitHub feature I have never used.
@chris48s Thanks Chris for responding, Yeah I had also saw the deprecation notice on github classic APIs. Alright, let me look into the graphQL APIs whether they require a user to expose their individual token or its just there for users to read data from. I'm on it.