From 221d5dc01244ffce0c14426e90b76f392d4c5dfa Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 4 Jan 2023 14:01:34 +0100 Subject: github: add update script --- krebs/3modules/github/update | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 krebs/3modules/github/update (limited to 'krebs/3modules/github/update') diff --git a/krebs/3modules/github/update b/krebs/3modules/github/update new file mode 100755 index 000000000..3952dabae --- /dev/null +++ b/krebs/3modules/github/update @@ -0,0 +1,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 -- cgit v1.2.3