From 3da3b53e5385c2ab7b0fbd8c676f0cd774a8512c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Sun, 2 Jun 2024 12:56:48 +0200 Subject: [PATCH] refactor: use repo view payload for topics --- extensions/make-yaml.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/make-yaml.sh b/extensions/make-yaml.sh index b2950f0..a1428d9 100755 --- a/extensions/make-yaml.sh +++ b/extensions/make-yaml.sh @@ -11,7 +11,7 @@ while IFS=, read -r category repo; do if [[ ! -f "${meta}" || (-f "${meta}" && $(find "$meta" -mtime +30)) ]]; then yaml_name="- name: $(basename ${repo})" yaml_path="path: https://github.com/${repo}" - repo_info=$(gh repo view --json owner,description "${repo}") + repo_info=$(gh repo view --json owner,description,latestRelease,licenseInfo,stargazerCount,repositoryTopics "${repo}") repo_owner=$(echo "${repo_info}" | jq -r ".owner.login") author=$(gh api "users/${repo_owner}" --jq ".name") if [[ -z "${author}" ]]; then @@ -23,13 +23,13 @@ while IFS=, read -r category repo; do description="No description available" fi description=$(echo "${description}" | sed 's/^[[:space:]]*//') - topics=$(gh api "repos/${repo}/topics" --jq ".names") + topics=$(echo "${repo_info}" | jq -r ".repositoryTopics | map(.name)") topics=$(echo "${topics}" | jq -r 'map(select(.) | sub("^quarto-"; ""))') topics=$(echo "${topics}" | jq -r 'map(select(.) | sub("-template[s]*"; ""))') topics=$(echo "${topics}" | jq -r 'map(select(.) | if test("filters$|formats$|journals$") then sub("s$"; "") else . end)') topics=$(echo "${topics}" | jq -r 'map(select(.) | sub("reveal-js"; "reveal.js") | sub("revealjs"; "reveal.js"))') topics=$(echo "${topics}" | jq -r 'map(select(. | test("quarto|extension|^pub$") | not))') - topics=$(echo "${topics}" | jq -r 'unique') + topics=$(echo "${topics}" | jq -c 'unique') yaml_usage="\n \n \`\`\`sh\n quarto add ${repo}\n \`\`\`" yaml_description="description: |\n ${description}${yaml_usage}" yaml_type="type: [${category}]"