Make the org a param. Check if it exists before quering to avoid infinite loops.

master
Manuele Simi 3 years ago
parent fb1c8f9e5e
commit 4f5be8c34e

@ -1,5 +1,28 @@
#!/usr/bin/env bash
organization="gCubeSystem"
#
# Generate the list of repositories for the selected organization on gitea
# Input: the gitea organization to browse
# Output: a file with one repository name (not URL) for each line
# Manuele Simi (ISTI-CNR)
#
organization=$1
echo "Getting the list of repos for ${organization}"
if [ -z "$organization" ]; then
echo "Missing organization name."
echo "Synopsis: generateRepoList.sh <org name>"
echo "Example: generateRepoList.sh gCubeSystem"
exit 1
else
#check if the organization exists
http_code=$(curl -s -o /dev/null -w "%{http_code}" "https://code-repo.d4science.org/api/v1/orgs/${organization}")
echo "Does org ${organization} exist? ${http_code}=200"
if [ "$http_code" -ne 200 ]; then
echo "Org ${organization} does no exist"
exit 1
fi
fi
pageCounter=1
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
empty="false"

Loading…
Cancel
Save