From 6d69ad9aefcc792e9df6c23e5810efba78946c0c Mon Sep 17 00:00:00 2001 From: Patrick Lewis <4015312+locus313@users.noreply.github.com> Date: Fri, 26 Jun 2026 22:16:53 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20ponytail=20audit=20=E2=80=94=20remove=20?= =?UTF-8?q?~330=20lines=20of=20redundant=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - lib: add err(), --api-version param to gh_api() - close-archived-alerts: collapse 3 close_*_alerts() into 1 generic close_alerts(); replace hand-rolled pagination with gh_api_paginate - copilot-report: collapse _copilot_api() 30→3 lines using --api-version; remove info()/warn() pass-through aliases - repo-permissions-report: remove info() pass-through alias - dockerfile-discovery: delete dead gh_api_link() + RESPONSE_LINK global; remove vestigial print_* redefines; inline check_prerequisites() - get-public-repos: inline check_prerequisites(); drop no-op print_error override - 7 pagination scripts: remove local get_repo_pagination() wrappers, use lib get_repo_page_count() directly - organize-stars: replace 7-line command check loop with require_command - archive-old-repos: inline validate_environment(); move local declarations to assignment site; drop stale comments - auto-repo-creation: merge add_teams_to_repo + add_repo_owners_to_repo into single add_team_to_repo with permission param - docs: update AGENTS.md and copilot-instructions.md with err(), --api-version, correct pagination example, and fill blank shared-library section Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/copilot-instructions.md | 22 +- AGENTS.md | 3 +- .../github-dockerfile-discovery.sh | 64 +----- .../github-get-public-repos.sh | 16 +- lib/github-common.sh | 15 +- ...ithub-add-repo-collaborators-by-pattern.sh | 12 +- .../github-add-repo-permissions.sh | 11 +- .../github-archive-old-repos.sh | 97 +++------ .../github-auto-repo-creation.sh | 29 +-- ...hub-close-archived-repo-security-alerts.sh | 205 ++++-------------- .../github-enable-issues.sh | 19 +- .../github-get-repo-list.sh | 11 +- ...ithub-migrate-internal-repos-to-private.sh | 11 +- .../github-organize-stars.sh | 9 +- .../github-copilot-report.sh | 78 ++----- .../github-monthly-issues-report.sh | 11 +- .../github-repo-permissions-report.sh | 19 +- 17 files changed, 149 insertions(+), 483 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index ea19be4..02aa54c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -23,6 +23,19 @@ Each script follows the `github-/github-.sh` naming co Provides reusable helpers sourced by scripts: +| Function | Purpose | +|----------|---------| +| `print_status` / `print_success` / `print_warning` / `print_error` | Colored output | +| `err ` | `print_error` + `exit 1` in one call | +| `require_env_var ` | Exit with message if variable unset/empty | +| `require_command ` | Exit if binary not in PATH | +| `configure_gh_auth [scope_hint]` | Bridge GITHUB_TOKEN→GH_TOKEN or verify gh auth session | +| `validate_github_token [bearer]` | Verify GITHUB_TOKEN via /user endpoint | +| `validate_slug