|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# Get the details of the repositories, to later use to include in the website. |
| 4 | +get_website_repo_details() { |
| 5 | + gh repo list steno-aarhus \ |
| 6 | + --json name,description,homepageUrl \ |
| 7 | + --visibility public \ |
| 8 | + --no-archived \ |
| 9 | + --source \ |
| 10 | + --topic ${1} | |
| 11 | + jq |
| 12 | +} |
| 13 | + |
| 14 | +# For larger project websites. |
| 15 | +get_website_repo_details website,project > data/projects.json |
| 16 | + |
| 17 | +# For documentation/resource/support websites. |
| 18 | +get_website_repo_details resource,website > data/resources.json |
| 19 | + |
| 20 | +# For software projects like R packages. |
| 21 | +get_website_repo_details software,website > data/software.json |
| 22 | + |
| 23 | +# For event websites like courses, seminars, conferences. |
| 24 | +get_website_repo_details event,website > data/events.json |
| 25 | + |
| 26 | +# For group websites. |
| 27 | +get_website_repo_details group,website > data/groups.json |
| 28 | + |
| 29 | +# For individual research projects, without websites. |
| 30 | +get_website_repo_details research-project > data/research-projects.json |
| 31 | + |
| 32 | +# Quarto expects the data in YAML format, so we need to convert the JSON files to YAML. |
| 33 | +for file in data/*.json; |
| 34 | +do |
| 35 | + # This seems to give an error... |
| 36 | + # yq -oy $file > "data/$(basename "$file" .json).yaml" |
| 37 | + |
| 38 | + # So have to first save it to a variable and then write it to a file. |
| 39 | + contents=$(yq -P -o=yaml $file) |
| 40 | + echo "$contents" > "data/$(basename "$file" .json).yaml" |
| 41 | +done |
0 commit comments