- Notifications
You must be signed in to change notification settings - Fork 0
Declare the Repository Description in registry/repos.json (#639)#913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4095ad6
Declare the Repository Description in registry/repos.json (#639)
ptr727 efd8404
Address Copilot review: strip-consistent length check, non-whitespace…
ptr727 e2843bc
Address CodeRabbit/qodo review: canonical-by-construction description…
ptr727 d7d8163
Defensively trim the declared description in configure.sh
ptr727 84b4cf7
Correct docstring/GOVERNANCE claims per Copilot round 3
ptr727 9b139b2
Guard configure.sh against an embedded newline in the declared descri…
ptr727 7dba8f1
Tighten the schema pattern and clarify GOVERNANCE.md per round-6 review
ptr727 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -64,6 +64,29 @@ esac | ||
| main_ruleset="$script_dir/main.json" | ||
| settings_file="$script_dir/settings.json" | ||
| # ----- Resolve the declared description (optional, shared by apply and check) ----- | ||
| # Per GOVERNANCE.md "Repository Details", once a repo declares registry/repos.json's `description` field, that field becomes the About panel's source rather than the README. | ||
| # The audit's description_findings() (spec/audit.py) measures the README, About, and Docker Hub mirror set against that same field. | ||
| # A repo with no declared field is left untouched here, so the README stays its source of truth. | ||
| description="" | ||
| if [ -f "$registry" ]; then | ||
| # Trimmed defensively even though spec/validate.py already rejects an untrimmed value. | ||
| # A registry edited ahead of its next validate.py run still resolves to the same canonical value spec/audit.py compares against. | ||
| if ! description="$(jq -r --arg n "$name" \ | ||
| '(.repos[] | select(.name==$n) | .description) // "" | gsub("^\\s+|\\s+$"; "")' "$registry")"; then | ||
| echo "Failed to read description from $registry (invalid JSON?)." >&2 | ||
| exit 1 | ||
| fi | ||
| # The trim above only strips leading/trailing whitespace, so an embedded newline or carriage return survives it. | ||
| # Caught here rather than left to reach `gh api` as a multi-line value. | ||
| case "$description" in | ||
| *$'\n'* | *$'\r'*) | ||
| echo "The declared description for $name in $registry carries an embedded newline. Fix it there (spec/validate.py rejects this once run)." >&2 | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| fi | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # ----- Ruleset id lookup (shared by apply and check) ----- | ||
| # Map a ruleset name to the id of the first match, leaving it empty when nothing matches. | ||
| # It warns on duplicates, and aborts on an API error or at the per_page cap, where a single-fetch lookup is unreliable. | ||
| @@ -158,7 +181,12 @@ cmd_apply() { | ||
| payload="$(jq --argjson d "$disc" '. + {has_discussions: $d}' "$settings_file")" | ||
| echo "Warning: $repo has no 'main' branch. Leaving default_branch unchanged." >&2 | ||
| fi | ||
| echo "Applying general settings (has_discussions=$disc)" | ||
| # The About description, only once a repo declares registry/repos.json's `description` (see the resolution above). | ||
| # Left untouched otherwise, so a repo that has not adopted the field yet keeps its hand-set (or README-derived) description. | ||
| if [ -n "$description" ]; then | ||
| payload="$(jq --arg desc "$description" '. + {description: $desc}' <<<"$payload")" | ||
| fi | ||
| echo "Applying general settings (has_discussions=$disc$([ -n "$description" ] && echo ", description from registry/repos.json"))" | ||
| printf '%s' "$payload" | gh api --method PATCH "repos/$repo" --input - >/dev/null | ||
| # ----- Dependabot alerts + automated security updates ----- | ||
| gh api --method PUT "repos/$repo/vulnerability-alerts" >/dev/null | ||
| @@ -275,6 +303,16 @@ check_settings() { | ||
| if gh api "repos/$repo/branches/main" --jq '.name' >/dev/null 2>&1; then | ||
| assert "default_branch = main" test "$(jq -r '.default_branch' <<<"$live")" = main | ||
| fi | ||
| # The About description, only where the registry declares one (see the resolution above). | ||
| # A repo that has not adopted the field is a manual-verify note, exactly as secrets are: nothing declared here to check against. | ||
| # The two reasons `$description` can be empty are told apart, since "no registry" and "no field for this repo" call for different follow-up. | ||
| if [ -n "$description" ]; then | ||
| assert "description = '$description'" test "$(jq -r '.description' <<<"$live")" = "$description" | ||
| elif [ ! -f "$registry" ]; then | ||
| note "description: no $registry to read (pass a plain repo argument or run from a hub checkout) - verify manually" | ||
| else | ||
| note "description: no registry/repos.json description declared for $name - verify manually (falls back to the README tagline, see GOVERNANCE.md 'Repository Details')" | ||
| fi | ||
| } | ||
| check_security() { | ||
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.