summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/github/update
blob: 3952dabae4ead401d4e749b3de40cb855fa90617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p cidr2glob curl git jq

# update known-hosts.json
#
# usage: ./update

set -efu

# XXX IPv6 addresses are currently ignored
curl -sS https://api.github.com/meta | jq -r .git[] | grep -v : | cidr2glob | jq -Rs 'split("\n")|map(select(.!=""))' > known-hosts.json

if git diff --exit-code known-hosts.json; then
  echo known-hosts.json is up to date: nothing to do >&2
fi