Skip to content

Getting Started

Prerequisites

The following tools are required to use this repository.

ToolPurposeInstall (macOS)Install (Debian/Ubuntu)
bashShell runtime for all scriptsbuilt-inapt install bash
makeTask runner — maps targets to shell scriptsxcode-select --installapt install make
ghGitHub CLI — authenticate and call GitHub APIsbrew install ghsee cli.github.com
jqJSON processing for API responsesbrew install jqapt install jq
batsShell test frameworkbrew install bats-coreapt install bats
shellcheckStatic analysis for bash scriptsbrew install shellcheckapt install shellcheck
dockerRequired for container workflow templatesDocker Desktopapt install docker.io
cargo/rustupRequired to build the devkit CLI appbrew install rustup`curl https://sh.rustup.rs

Verify your environment

bash
command -v bash make gh jq bats shellcheck

Check Git submodules (Bats helpers) are initialised:

bash
git submodule update --init --recursive

Authenticate with GitHub

Log in and request the scopes needed by all scripts:

bash
gh auth login

If you already have a token but need to add package scopes:

bash
gh auth refresh --scopes read:packages,delete:packages

Verify authenticated scopes:

bash
gh auth status

Required scopes

purge-packages.sh requires read:packages for dry-runs and additionally delete:packages for actual deletion. The script checks both and prints a clear remediation command if scopes are missing.

Common first commands

bash
make help      # list all available targets
make test      # run the full Bats test suite
make lint      # run ShellCheck on every script

Makefile target overview

TargetAction
helpPrint all available targets with descriptions
purge-actionsDelete GitHub Actions workflow runs
purge-packagesDelete GitHub package versions
purge-releaseDelete GitHub releases
purge-tagsDelete Git tags from a remote repo
detect-botsFind (and optionally purge) bot commits
scan-secretsScan working tree / history for secret patterns
testRun all Bats tests under tests/github/
test-<script>Run tests for a single script
lintRun ShellCheck with --severity=warning

Usage model

All scripts are invoked through the root Makefile, which forwards extra flags through ARGS:

bash
make purge-actions  ARGS="--repo owner/repo --dry-run"
make purge-packages ARGS="--owner your-user --package-type container --dry-run"
make purge-release  ARGS="--repo owner/repo --keep-latest 3"
make purge-tags     ARGS="--repo owner/repo --tag-pattern 'v0.*' --dry-run"
make detect-bots    ARGS="--repo owner/repo --format json"
make scan-secrets   ARGS="--local --history"

You can also call scripts directly:

bash
./shell/github/purge-actions.sh --help
./shell/github/scan-secrets.sh --dry-run

Safety guidance

All destructive scripts support --dry-run. Always preview before deleting.

bash
# See what would be deleted — nothing is removed
make purge-packages ARGS="--owner you --package-type container --dry-run"

# Then run without --dry-run once satisfied
make purge-packages ARGS="--owner you --package-type container --keep-latest 2"

Use --keep-latest <n> to retain a minimum number of recent artifacts:

bash
make purge-actions ARGS="--repo owner/repo --keep-latest 5"

Use pattern flags to narrow the target set before deleting:

bash
make purge-tags    ARGS="--repo owner/repo --tag-pattern 'v0.*' --dry-run"
make purge-packages ARGS="--owner you --version-pattern '*-rc*' --dry-run"

Testing a single script

bash
make test-purge-actions
make test-purge-packages
make test-scan-secrets

All tests use mocked gh and jq binaries — no real GitHub calls are made.

Documentation map