Run3 calculate github community metrics
Processes JSON data from GitHub Search results to compute specific repository health metrics including average merge time, top contributors, and bug resolution counts.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill run3_calculate_github_community_metricsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.7 KB, 386 tokens by cl100k_base, as published. Nobody here has run it
When calculating metrics from the JSON output of a paginated GitHub Search API call, use the following logic patterns:
PR Metrics
- Merged Count: Filter items where
merged_at != null. - Closed Count: Filter items where
state == "closed"andmerged_at == null. - Average Merge Days:
- Filter for merged PRs.
- Calculate the difference between
merged_atandcreated_atusing( (.merged_at | fromdateiso8601) - (.created_at | fromdateiso8601) ) / 86400. - Use
add / lengthto find the average androundor multiplication/division logic for decimal precision.
- Top Contributor: Use
group_by(.user.login), sort by group length, and select the login of the last group.
Issue Metrics
- Bug Identification: Use a case-insensitive check for the substring "bug" within any of the issue's labels. Logic:
.labels[].name | ascii_downcase | contains("bug"). - Resolved Bugs: To accurately report bugs resolved during a month, query for issues closed in that period (
closed:YYYY-MM-DD..YYYY-MM-DD) and then filter the results for labels containing "bug".
JQ Integration Example
To compute average merge time to one decimal place:
jq '[.[] | select(.merged_at != null) | ((.merged_at | fromdateiso8601) - (.created_at | fromdateiso8601)) / 86400] | (add / length * 10 | round / 10)' input.json
To identify the user who opened the most PRs:
jq -r 'group_by(.user.login) | sort_by(length) | last | .[0].user.login' input.json
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.