Skip to content

Instantly share code, notes, and snippets.

@MikeeI
Last active May 17, 2022 18:28
Show Gist options
  • Save MikeeI/7abe0dc48521fff6686271c312c09d74 to your computer and use it in GitHub Desktop.
Save MikeeI/7abe0dc48521fff6686271c312c09d74 to your computer and use it in GitHub Desktop.
#!/bin/bash
base_url="https://ce987049f84bba9d289197c0b600d84ceb039d42991c8783:@packagecloud.io"
#curl https://ce987049f84bba9d289197c0b600d84ceb039d42991c8783:@packagecloud.io/api/v1/distributions
dist=$(curl -ss "$base_url/api/v1/repos/grafana/stable/packages.json" | | jq -r '.[]' | jq -r '[.version,.distro_version,.downloads_count_url] | @csv' | tr -d '"' )
while IFS= read -r line; do
dl_url=$(echo $line | awk -F"," '{print $3}'
dl_count=$(curl -ss "$base_url$dl_url" | jq -r .)
distro=$(echo $line | awk -F"," '{print $2}'
version=$(echo $line | awk -F"," '{print $1}'
echo "$distro - $version - $dl_count"
done <<< "$dist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment