Ultima attività 1723864300

Get repo size from GitHub API

github-repo-size.sh Raw
1#!/bin/bash
2
3if [ $# -ne 1 ]; then
4 echo "Usage: $0 owner/repo"
5 exit 1
6fi
7
8repo_info=$1
9
10repo_size=$(curl -s "https://api.github.com/repos/${repo_info}" | jq '.size' | numfmt --to=iec --from-unit=1024 | tr -d '\n')
11
12echo "${repo_size}"
13