#!/bin/bash # last_commit.sh — Get the last commit date for raspberrypi/firmware/boot REPO="raspberrypi/firmware" PATH_FILTER="boot" API_URL="https://api.github.com/repos/${REPO}/commits?path=${PATH_FILTER}&per_page=1" response=$(curl -sf \ -H "Accept: application/vnd.github+json" \ "$API_URL") if [[ $? -ne 0 || -z "$response" ]]; then echo "Error: Failed to reach GitHub API" >&2 exit 1 fi echo "$response" | python3 -c " import sys, json from datetime import datetime d = json.load(sys.stdin) c = d[0]['commit'] raw_date = c['committer']['date'] formatted = datetime.strptime(raw_date, '%Y-%m-%dT%H:%M:%SZ').strftime('%Y.%m.%d') print('Date: ', formatted) print('Author: ', c['author']['name']) print('Message:', c['message'].splitlines()[0][:80]) "