1
0
forked from mirror/misskey

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
This commit is contained in:
Acid Chicken (硫酸鶏) 2018-12-10 23:22:52 +09:00 committed by MeiMei
parent a6dc0f3684
commit e16906afc3
4 changed files with 47 additions and 3 deletions

3
.autogen/check_pr.jq Normal file
View File

@ -0,0 +1,3 @@
.[]
.head
.label

2
.autogen/next_url.jq Normal file
View File

@ -0,0 +1,2 @@
.links
.next

39
.autogen/patreon.jq Normal file
View File

@ -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

View File

@ -5,7 +5,7 @@
# __MISSKEY_HEAD=acid-chicken:patch-autogen # __MISSKEY_HEAD=acid-chicken:patch-autogen
# __MISSKEY_REPO=syuilo/misskey # __MISSKEY_REPO=syuilo/misskey
# __MISSKEY_BRANCH=develop # __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)/.." && \ cd "$(dirname $0)/.." && \
touch null.cache && \ touch null.cache && \
rm *.cache && \ rm *.cache && \
@ -30,7 +30,7 @@ while :
touch patreon.cache && \ touch patreon.cache && \
rm patreon.cache && \ rm patreon.cache && \
cat patreon.raw.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 '<table><tr>' >> patreon.md.cache && \ echo '<table><tr>' >> patreon.md.cache && \
cat patreon.cache | \ cat patreon.cache | \
awk -F'\t' '{print $2,$1}' | \ awk -F'\t' '{print $2,$1}' | \
@ -43,7 +43,7 @@ while :
xargs -I% echo '<td><a href="%</a></td>' >> patreon.md.cache && \ xargs -I% echo '<td><a href="%</a></td>' >> patreon.md.cache && \
echo '</tr></table>' >> patreon.md.cache || \ echo '</tr></table>' >> patreon.md.cache || \
exit 1 exit 1
new_url="$(cat patreon.raw.cache | jq -r '.links.next')" new_url="$(cat patreon.raw.cache | jq -r -f next_url.jq)"
test "$new_url" = 'null' && \ test "$new_url" = 'null' && \
break || \ break || \
URL="$url" URL="$url"