Skip to content

Commit

Permalink
Switch to consuming JSON from GitHub for "latest commit touching file"
Browse files Browse the repository at this point in the history
For some reason, https://github.com/xxx/yyy/commits/HEAD/zzz.atom has recently changed from returning XML by default to returning JSON, which from https://docs.github.com/en/rest/activity/feeds?apiVersion=2022-11-28 seems like it's intentional, so this adds an explicit `Accept:` header (the only explicit JSON one that seems to work) and uses `jq` to determine the latest commit instead of hacking up the XML via `grep`+`awk`.

See also docker-library/docker#472

(Additionally, this switches the file to use `wget` consistently instead of a mix of `wget` and `curl`)
  • Loading branch information
tianon committed Jan 9, 2024
1 parent b3a7a55 commit 161d456
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tianon/update-cirros-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ node {
version="$(< arches/version)"
updated="$(curl -fsSL "https://github.com/cirros-dev/cirros/commits/$version.atom" |tac|tac| sed -nre '/.*<updated>(.+)<[/]updated>.*/ { s//\\1/p; q }' | xargs -i'{}' date --date '{}' --rfc-2822 --utc)"
updated="$(curl -fsSL --header 'Accept: application/json' "https://github.com/cirros-dev/cirros/commits/$version.atom" | jq -r '.payload | first(.commitGroups[].commits[] | [ .committedDate, .authoredDate ] | sort | reverse[])' | xargs -i'{}' date --date '{}' --rfc-2822 --utc)"
export GIT_AUTHOR_DATE="$updated"
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
Expand Down

0 comments on commit 161d456

Please sign in to comment.