Improve contributions-for-user.sh: surface authored PRs, group commits, skip empty areas#1532
Draft
Ivaylogi98 wants to merge 1 commit into
Draft
Conversation
…s, skip empty areas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reworks
toc/working-groups/contributions-for-user.shso the generated gists actually reflect a user's contribution footprint. The previous version omitted authored PRs entirely, generated empty gists for unrelated areas, and missed several categories of contribution relevant to RFC-0006 approver requirements.Why
Running the script as a candidate for approver returned gists that contained only review/comment activity — no authored PRs, no code contributions on others' PRs, and a flood of empty gists for areas the user has never touched. This made the output unusable for assembling evidence of substantial contributions.
Changes
New sections in the gist
Correctness fixes
${wg}instead of${WORKING_GROUP}, producing empty-prefixed filenames.yqcommit-message parsing used.commit.message | split("\n")[0]which raised!!seq cannot be added to !!str. Fixed to((.commit.message | split("\n"))[0]).bosh-agent#393is one example). Added a targeted events-based fallback that does single-PR lookups for any PR numbers visible in the user's events but missing from search results.repos/{repo}/commits?author=which filters by email rather than login, missing most commits. Replaced withsearch/commits?q=author:${user}+repo:${repo}.USERNAMEviagh api users/${USERNAME}so the GitHub search API (case-sensitive onauthor:/reviewed-by:qualifiers) matches reliably.Performance / robustness
--paginateadded tosearch/commitsso >100 commits are not silently dropped.payload.action == "opened"so each PR triggers at most one API lookup, not one per recorded event.local -A seen).emit_pr_with_commitspromoted from a nested closure to a top-level function with an explicitrepoparameter, removing the implicit closure-by-name on the outer function's${repo}.cloak-previewandgroot-previewAccept headers — both endpoints have been stable for years.#!/usr/bin/env bashwith an explicit bash 4+ version check, since the script now relies on associative arrays. macOS users on the system bash 3.2 get a clear "install bash via Homebrew" message instead of crypticlocal -Aerrors mid-run.Testing
Ran against
Foundational Infrastructurefor an approver-candidate user. Areas with no contributions are now skipped; areas with contributions produce gists with all five sections populated, including PRs the GitHub search index had been silently dropping.Authored with Claude Code