diff --git a/features/src/utils/devcontainer-feature.json b/features/src/utils/devcontainer-feature.json index 3512dc32..93b7fb4e 100644 --- a/features/src/utils/devcontainer-feature.json +++ b/features/src/utils/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "devcontainer-utils", "id": "utils", - "version": "23.10.4", + "version": "23.10.5", "description": "A feature to install RAPIDS devcontainer utility scripts", "containerEnv": { "BASH_ENV": "/etc/bash.bash_env" diff --git a/features/src/utils/opt/devcontainer/bin/github/repo/clone.sh b/features/src/utils/opt/devcontainer/bin/github/repo/clone.sh index bf2d974c..092f7249 100755 --- a/features/src/utils/opt/devcontainer/bin/github/repo/clone.sh +++ b/features/src/utils/opt/devcontainer/bin/github/repo/clone.sh @@ -32,8 +32,7 @@ get_user_fork_name() { if [ "${user}" = "${owner}" ]; then echo "${owner}/${name}"; else - gh repo list "${user}" --fork --json nameWithOwner --json parent --jq "$(cat <<________EOF | tr -s '[:space:]' - . + local query="$(cat <<________EOF | tr -s '[:space:]' | map(select( .parent.name == "${name}" and @@ -42,6 +41,16 @@ get_user_fork_name() { | map(.nameWithOwner)[] ________EOF )"; + local nameWithOwner="$(gh repo list "${user}" --fork --json nameWithOwner --json parent --jq ". ${query}" 2>/dev/null || echo "")"; + if test -z "${nameWithOwner}"; then + for repo in $(gh repo list "${user}" --fork --json name --jq 'map(.name)[]'); do + nameWithOwner="$(gh repo view "${repo}" --json nameWithOwner --json parent --jq "[.] ${query}" 2>/dev/null || echo "")"; + if test -n "${nameWithOwner}"; then + break; + fi + done + fi + echo -n "${nameWithOwner:-}"; fi }