Skip to content

Commit

Permalink
fallback to querying each repo if querying all of them fails (due to …
Browse files Browse the repository at this point in the history
…SAML errors)
  • Loading branch information
trxcllnt committed Aug 21, 2023
1 parent 3118ab6 commit 2e24216
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion features/src/utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
13 changes: 11 additions & 2 deletions features/src/utils/opt/devcontainer/bin/github/repo/clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 2e24216

Please sign in to comment.