Skip to content

Instantly share code, notes, and snippets.

@chmouel
Last active August 10, 2025 09:17
Show Gist options
  • Save chmouel/629497501ad37440c853be32ca7e2d95 to your computer and use it in GitHub Desktop.
Save chmouel/629497501ad37440c853be32ca7e2d95 to your computer and use it in GitHub Desktop.
update gemini-cli aur/arch package with latest, showing changelog betwee latest version
#!/usr/bin/env bash
# Author: Chmouel Boudjnah <[email protected]>
set -eufo pipefail
GITHUB_TOKEN="${GITHUB_TOKEN:-$(pass show github/chmouel-token)}"
latest=$(curl -H "Authorization: ${GITHUB_TOKEN}" -s https://api.github.com/repos/google-gemini/gemini-cli/releases | jq -r '[.[] | select(.prerelease == false and (.tag_name | contains("nightly") | not))][0].tag_name')
latest=${latest#v}
pkgversion=$(grep '^pkgver=' PKGBUILD)
pkgversion=${pkgversion#pkgver=}
previous=$(curl -H "Authorization: ${GITHUB_TOKEN}" -s https://api.github.com/repos/google-gemini/gemini-cli/releases | jq -r '[.[] | select(.prerelease == false and (.tag_name | contains("nightly") | not))][1].tag_name')
printf "\e]66;s=2;Showing changelog between %s and %s\a\n" ${previous} ${latest}
echo
printf "\e]66;s=2;━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\a\n"
echo
curl -H "Authorization: ${GITHUB_TOKEN}" -s "https://api.github.com/repos/google-gemini/gemini-cli/compare/${previous}...v${pkgversion}" |
jq -r '.commits[] |
. as $commit |
(.commit.message | match("#([0-9]+)"; "g") // empty) as $pr |
if $pr then
"- \(.commit.message | split("\n")[0]) (by \u001b[36m\(.commit.author.name)\u001b[0m) \u001b]8;;https://github.com/google-gemini/gemini-cli/pull/\($pr.captures[0].string)\u001b\\\u001b[32m#\($pr.captures[0].string)\u001b[0m\u001b]8;;\u001b\\ \u001b]8;;\(.html_url)\u001b\\\u001b[33m[\(.sha[0:7])]\u001b[0m\u001b]8;;\u001b\\"
else
"- \(.commit.message | split("\n")[0]) (by \u001b[36m\(.commit.author.name)\u001b[0m) \u001b]8;;\(.html_url)\u001b\\\u001b[33m[\(.sha[0:7])]\u001b[0m\u001b]8;;\u001b\\"
end' | sort -k2,2 -t'(' --key=2 | sort -s -k1,1r -t'-' --key=1
if [[ ${pkgversion} != "${latest}" ]]; then
echo "Updating PKGBUILD from ${pkgversion} to ${latest}"
sed -i "s/pkgver=${pkgversion}/pkgver=${latest}/" PKGBUILD
else
echo
printf "\033[3;31mPKGBUILD is already up to date with version %s\033[0m\n" "${pkgversion}"
exit 0
fi
updpkgsums && makepkg --printsrcinfo >.SRCINFO
makepkg -srif
@chmouel
Copy link
Author

chmouel commented Aug 10, 2025

on kitty it shows large font and clickable links for pr/commit

output look like this

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment