From 4365134fbb0e85e22e2a8a2ba29a338c21aa9698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Mon, 10 Dec 2018 23:22:52 +0900 Subject: [PATCH] Refactor /.autogen (#3551) * Create patreon.jq * Create check_pr.jq * Rename check_pr.jq to .autogen/check_pr.jq * Create next_url.jq * Update autogen.sh * Rename autogen.sh to update_readme_patreon.sh --- .autogen/check_pr.jq | 3 ++ .autogen/next_url.jq | 2 + .autogen/patreon.jq | 39 +++++++++++++++++++ .../{autogen.sh => update_readme_patreon.sh} | 6 +-- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .autogen/check_pr.jq create mode 100644 .autogen/next_url.jq create mode 100644 .autogen/patreon.jq rename .autogen/{autogen.sh => update_readme_patreon.sh} (87%) diff --git a/.autogen/check_pr.jq b/.autogen/check_pr.jq new file mode 100644 index 000000000..0adb0b503 --- /dev/null +++ b/.autogen/check_pr.jq @@ -0,0 +1,3 @@ +.[] +.head +.label diff --git a/.autogen/next_url.jq b/.autogen/next_url.jq new file mode 100644 index 000000000..b4c3b819a --- /dev/null +++ b/.autogen/next_url.jq @@ -0,0 +1,2 @@ +.links +.next diff --git a/.autogen/patreon.jq b/.autogen/patreon.jq new file mode 100644 index 000000000..c761d587b --- /dev/null +++ b/.autogen/patreon.jq @@ -0,0 +1,39 @@ +( + .data | + map( + select( + .relationships + .currently_entitled_tiers + .data[] + ) + ) | + map( + .relationships + .user + .data + .id + ) +) as $data | +.included | +map( + select( + .id as $id | + $data | + contains( + [ + $id + ] + ) + ) +) | +map( + .attributes | + [ + .full_name, + .thumb_url, + .url + ] | + @tsv +) | +.[] | +@text diff --git a/.autogen/autogen.sh b/.autogen/update_readme_patreon.sh similarity index 87% rename from .autogen/autogen.sh rename to .autogen/update_readme_patreon.sh index 30198f804..8f40a7899 100755 --- a/.autogen/autogen.sh +++ b/.autogen/update_readme_patreon.sh @@ -5,7 +5,7 @@ # __MISSKEY_HEAD=acid-chicken:patch-autogen # __MISSKEY_REPO=syuilo/misskey # __MISSKEY_BRANCH=develop -test "$(curl -LSs -w '\n' -- "https://api.github.com/repos/$REPO/pulls?access_token=$__MISSKEY_GITHUB_TOKEN" | jq -r '.[].head.label' | grep $__MISSKEY_HEAD)" && exit 1 +test "$(curl -LSs -w '\n' -- "https://api.github.com/repos/$REPO/pulls?access_token=$__MISSKEY_GITHUB_TOKEN" | jq -r -f check_pr.jq | grep $__MISSKEY_HEAD)" && exit 1 cd "$(dirname $0)/.." && \ touch null.cache && \ rm *.cache && \ @@ -30,7 +30,7 @@ while : touch patreon.cache && \ rm patreon.cache && \ cat patreon.raw.cache | \ - jq -r '(.data|map(select(.relationships.currently_entitled_tiers.data[]))|map(.relationships.user.data.id))as$data|.included|map(select(.id as$id|$data|contains([$id])))|map(.attributes|[.full_name,.thumb_url,.url]|@tsv)|.[]|@text' >> patreon.cache && \ + jq -r -f patreon.jq >> patreon.cache && \ echo '' >> patreon.md.cache && \ cat patreon.cache | \ awk -F'\t' '{print $2,$1}' | \ @@ -43,7 +43,7 @@ while : xargs -I% echo '