dcg

GitHub Platform

platform.github

Protects against destructive GitHub CLI operations like changing repository visibility or deleting repositories, gists, releases, or SSH keys.

  • 20blocking rules
  • 13safe patterns
  • 19High
  • 1Medium
~/.config/dcg/config.toml
[packs]
enabled = ["platform.github"]

Evaluated when a command contains gh, curl.

Recorded verdicts

  • gh repo delete acme/api --yesBlockedplatform.github:gh-repo-delete

Blocking rules

Each rule ID is platform.github:<name>. Use it in allowlists and [policy.rules].

  1. curl-api-delete-repo

    High

    curl DELETE /repos/{owner}/{repo} permanently deletes a GitHub repository. This cannot be undone.

    Explanation
    This is the REST spelling of `gh repo delete`. It removes the code, issues, pull requests, releases, wiki, and Actions history together. GitHub can restore a deleted repository only within 90 days, only if the name has not been reused, and only via support. Safer alternatives: - gh api -X PATCH repos/<owner>/<repo> -F archived=true: read-only, via the API - gh repo view: confirm the target first
  2. gh-api-delete-actions-secret

    High

    gh api DELETE actions/secrets removes GitHub Actions secrets.

    Explanation
    Secret values are write-only, so a deleted secret cannot be read back or restored. Every workflow referencing it fails on the next run. Safer alternative: - gh secret set <NAME>: rotate the value in place via the first-class verb
  3. gh-api-delete-actions-variable

    High

    gh api DELETE actions/variables removes GitHub Actions variables.

    Explanation
    Workflows referencing a missing variable resolve it to an empty string rather than failing loudly, so the breakage is easy to miss. Safer alternative: - gh variable set <NAME>: update the value via the first-class verb
  4. gh-api-delete-deploy-key

    High

    gh api DELETE keys removes deploy keys.

    Explanation
    Deploy keys are how servers and CI clone this repository without a user account. Removing one breaks those consumers immediately, usually surfacing on someone else's next deploy. Confirm what depends on it: gh repo deploy-key list
  5. gh-api-delete-generic

    High

    gh api DELETE calls can be destructive. Please verify the endpoint.

    Explanation
    This is the catch-all for raw-API deletions whose endpoint this pack does not recognize, so the blast radius is unknown rather than known-large — it covers both `DELETE /repos/{owner}/{repo}` scale operations and routine ones like removing a label or an assignee. Before reaching for a raw API DELETE, check whether `gh` has a first-class verb for it: those are more readable, and several are allowed outright. For example, sub-issue hierarchy has dedicated verbs: - gh issue edit <child> --remove-parent - gh issue edit <parent> --remove-sub-issue <number> Preview what the endpoint returns before deleting it: gh api <endpoint>
  6. gh-api-delete-hook

    High

    gh api DELETE hooks removes repository webhooks.

    Explanation
    Removing a webhook silently stops every downstream integration it feeds — CI triggers, chat notifications, deployment hooks. Nothing errors; events simply stop arriving, so the failure surfaces late and somewhere else. Inspect first, and note the config so it can be recreated: gh api repos/<owner>/<repo>/hooks
  7. gh-api-delete-release

    High

    gh api DELETE releases removes GitHub releases.

    Explanation
    Deleting a release destroys its uploaded assets. Install scripts and pinned CI jobs that fetch by that release URL start getting 404s immediately. Safer alternative: - gh release edit <tag> --draft: unpublish while keeping the assets
  8. gh-api-delete-repo

    High

    gh api DELETE /repos/{owner}/{repo} permanently deletes a GitHub repository. This cannot be undone.

    Explanation
    This is the raw-API spelling of `gh repo delete`. It removes the code, issues, pull requests, releases, wiki, and Actions history together. GitHub can restore a deleted repository only within 90 days, only if the name has not been reused, and only via support. Safer alternatives: - gh api -X PATCH repos/<owner>/<repo> -F archived=true: read-only, via the API - gh repo archive: the same thing via the first-class verb (dcg gates that one too, but archiving is reversible)
  9. gh-gist-delete

    High

    gh gist delete permanently deletes a Gist.

    Explanation
    Gist deletion is immediate and permanent — there is no trash and no support-side restore. Any URL you have shared, and anything embedding the Gist, breaks at once. Save the contents first: gh gist view <id> > backup.txt
  10. gh-issue-delete

    High

    gh issue delete permanently deletes an issue.

    Explanation
    Issue deletion is permanent and takes the whole discussion thread with it. Almost every reason to delete an issue is better served by closing it, which preserves the history and the cross-references other issues rely on. Safer alternative: - gh issue close <number> --reason 'not planned'
  11. gh-release-delete

    High

    gh release delete permanently deletes a release.

    Explanation
    Deleting a release destroys its uploaded assets. Anyone installing by that release URL — install scripts, CI pipelines, package managers pinned to it — starts getting 404s immediately, and the binaries cannot be recovered unless you still have them locally. Safer alternative: - gh release edit <tag> --draft: unpublish while keeping the assets
  12. gh-repo-archive

    High

    gh repo archive makes a repository read-only. While reversible, it stops all write access.

    Explanation
    Archiving is reversible, but until it is reversed nobody can push, open issues, or comment, and automation that writes to the repository starts failing. Unarchive from the web UI (Settings) or with the REST API. Reverse it with: gh api -X PATCH repos/<owner>/<repo> -F archived=false
  13. gh-repo-delete

    High

    gh repo delete permanently deletes a GitHub repository. This cannot be undone.

    Explanation
    Deleting a repository removes its code, issues, pull requests, releases, wiki, and Actions history together. GitHub can restore a deleted repository only within 90 days, only if the name has not been reused, and only via support — it is not a self-service undo. Safer alternatives: - gh repo archive: makes it read-only while keeping everything visible (dcg gates this one too, but it is reversible) - gh repo view: confirms the target before any destructive action
  14. gh-repo-deploy-key-delete

    High

    gh repo deploy-key delete removes a deploy key and can break access.

    Explanation
    Deploy keys are how servers and CI clone this repository without a user account. Removing one breaks those consumers immediately, and the failure usually surfaces on someone else's next deploy rather than here. Confirm what depends on it: gh repo deploy-key list
  15. gh-repo-visibility-change

    High

    gh repo edit --visibility changes repository visibility and can remove stars or detach forks.

    Explanation
    Changing repository visibility has consequences beyond access control. GitHub warns that a transition can remove stars and watchers, detach public forks, disable push rulesets, and expose Actions history or logs to newly eligible users. Treat every visibility transition as a consequential repository mutation and obtain explicit approval for the exact repository and target visibility.
  16. gh-run-cancel

    High

    gh run cancel stops a workflow run and may interrupt deployments.

    Explanation
    Cancelling mid-run can leave a deployment half-applied: a job that has already pushed some resources stops before its cleanup or rollback steps. Check what the run is doing before stopping it. Inspect first: gh run view <run-id>
  17. gh-secret-delete

    High

    gh secret delete removes GitHub Actions secrets.

    Explanation
    Secret values are write-only — GitHub will not show you the value, so a deleted secret cannot be restored unless you hold it somewhere else. Every workflow referencing it starts failing on the next run, often mid-deploy. Safer alternative: - gh secret set <NAME>: rotate the value in place, no window with it missing
  18. gh-ssh-key-delete

    High

    gh ssh-key delete removes an SSH key, potentially breaking access.

    Explanation
    Removing an SSH key takes effect immediately for every machine using it. If it is the key for the session you are in, or the only key on a remote host, you lose git push/pull access and may lock yourself out of automation that authenticates with it. Confirm which key you are about to remove: gh ssh-key list
  19. gh-variable-delete

    High

    gh variable delete removes GitHub Actions variables.

    Explanation
    Workflows referencing the variable resolve it to an empty string rather than failing loudly, so the breakage can be silent — a deploy target or feature flag quietly becomes blank. Safer alternative: - gh variable set <NAME>: change the value without a window where it is unset
  20. gh-release-delete-asset

    Medium

    gh release delete-asset permanently deletes an uploaded release asset.

    Explanation
    The release itself stays published, but the named asset is removed immediately and cannot be restored from GitHub. Anything downloading that asset by URL — install scripts, CI pipelines, package managers pinned to it — starts getting 404s until an identical file is re-uploaded. Safer alternatives: - gh release download <tag> --pattern <asset>: keep a copy first - gh release upload <tag> <file> --clobber: replace the asset in place

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • gh-repo-list-view
  • gh-gist-list-view
  • gh-release-list-view
  • gh-issue-list-view
  • gh-ssh-key-list
  • gh-secret-list
  • gh-variable-list
  • gh-auth-status
  • gh-status
  • gh-api-explicit-get
  • gh-help
  • gh-help-short
  • gh-help-topic