From e9b3e1efe97dbc3bc2102aa4e34d65886b3bf801 Mon Sep 17 00:00:00 2001 From: Nicholas Dille Date: Tue, 17 Sep 2024 13:31:15 +0200 Subject: [PATCH] Added script for rebuilding all tools --- scripts/rebuild-all.sh | 66 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 scripts/rebuild-all.sh diff --git a/scripts/rebuild-all.sh b/scripts/rebuild-all.sh new file mode 100644 index 0000000000..14441ffd95 --- /dev/null +++ b/scripts/rebuild-all.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -o errexit + +if test -z "${GITHUB_TOKEN}"; then + echo "ERROR: GITHUB_TOKEN is not set" + exit 1 +fi +: "${ref:=main}" +: "${workflow:=rebuild.yml}" +: "${repository:=uniget-org/tools}" +: "${batch_size:=100}" + +function dispatch() { + local repository="${1}" + local ref="${2}" + local workflow="${3}" + local tools="${4}"^ + local dryrun="${5:-false}" + + CURL="curl" + if test -n "${dryrun}" && test "${dryrun}" == "true"; then + CURL="echo curl" + fi + + ${CURL} --silent --show-error --location --fail \ + --header "Authorization: Bearer ${GITHUB_TOKEN}" \ + --url "https://api.github.com/repos/${repository}/actions/workflows/${workflow}/dispatches" \ + --data "{\"ref\": \"${ref}\", \"inputs\": {\"tool\": \"$(echo "${tools}" | xargs echo)\"}}" +} + +make metadata.json + +TOOLS_DEPS="$( + jq --raw-output '.tools[] | select(.build_dependencies != null) | .build_dependencies[]'