Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / test / check-by-name / update-pinned-tool.sh
blob7240bd597f13156504d1ae3083e2e2a2f955bb63
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-check-by-name
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"