1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p jq curl
4 set -o pipefail
-o errexit
-o nounset
6 trace
() { echo >&2 "$@"; }
8 SCRIPT_DIR
=$
( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev
/null
&& pwd )
10 repository
=NixOS
/nixpkgs-vet
11 pin_file
=$SCRIPT_DIR/pinned-version.txt
13 trace
-n "Fetching latest release of $repository.. "
14 latestRelease
=$
(curl
-sSfL \
15 -H "Accept: application/vnd.github+json" \
16 -H "X-GitHub-Api-Version: 2022-11-28" \
17 https
://api.github.com
/repos
/"$repository"/releases
/latest
)
18 latestVersion
=$
(jq .tag_name
-r <<< "$latestRelease")
19 trace
"$latestVersion"
21 trace
"Updating $pin_file"
22 echo "$latestVersion" > "$pin_file"