Конечные точки REST API для метрик сообщества
Используйте REST API для получения сведений о профиле сообщества.
Get community profile metrics
Returns all community profile metrics for a repository. The repository cannot be a fork.
The returned metrics include an overall health score, the repository description, the presence of documentation, the detected code of conduct, the detected license, and the presence of ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE, README, and CONTRIBUTING files.
The health_percentage
score is defined as a percentage of how many of
the recommended community health files are present. For more information, see
"About community profiles for public repositories."
content_reports_enabled
is only returned for organization-owned repositories.
Подробные маркеры доступа для "Get community profile metrics
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Contents" repository permissions (read)
Эту конечную точку можно использовать без проверки подлинности или указанных выше разрешений, если запрашиваются только общедоступные ресурсы.
Параметры для "Get community profile metrics"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
Коды состояния http-ответа для "Get community profile metrics"
Код состояния | Описание |
---|---|
200 | OK |
Примеры кода для "Get community profile metrics"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com
выделенный поддомен api.SUBDOMAIN.ghe.com
предприятия.
Пример запроса
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/community/profile
Response
Status: 200
{
"health_percentage": 100,
"description": "My first repository on GitHub!",
"documentation": null,
"files": {
"code_of_conduct": {
"name": "Contributor Covenant",
"key": "contributor_covenant",
"url": "https://api.github.com/codes_of_conduct/contributor_covenant",
"html_url": "https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"
},
"code_of_conduct_file": {
"url": "https://api.github.com/repos/octocat/Hello-World/contents/CODE_OF_CONDUCT.md",
"html_url": "https://github.com/octocat/Hello-World/blob/master/CODE_OF_CONDUCT.md"
},
"contributing": {
"url": "https://api.github.com/repos/octocat/Hello-World/contents/CONTRIBUTING",
"html_url": "https://github.com/octocat/Hello-World/blob/master/CONTRIBUTING"
},
"issue_template": {
"url": "https://api.github.com/repos/octocat/Hello-World/contents/ISSUE_TEMPLATE",
"html_url": "https://github.com/octocat/Hello-World/blob/master/ISSUE_TEMPLATE"
},
"pull_request_template": {
"url": "https://api.github.com/repos/octocat/Hello-World/contents/PULL_REQUEST_TEMPLATE",
"html_url": "https://github.com/octocat/Hello-World/blob/master/PULL_REQUEST_TEMPLATE"
},
"license": {
"name": "MIT License",
"key": "mit",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"html_url": "https://github.com/octocat/Hello-World/blob/master/LICENSE",
"node_id": "MDc6TGljZW5zZW1pdA=="
},
"readme": {
"url": "https://api.github.com/repos/octocat/Hello-World/contents/README.md",
"html_url": "https://github.com/octocat/Hello-World/blob/master/README.md"
}
},
"updated_at": "2017-02-28T19:09:29Z",
"content_reports_enabled": true
}