diff --git a/src/github-cli/scripts/install-extensions.sh b/src/github-cli/scripts/install-extensions.sh index f8a893534..05285aa7b 100644 --- a/src/github-cli/scripts/install-extensions.sh +++ b/src/github-cli/scripts/install-extensions.sh @@ -26,10 +26,12 @@ install_extension() { mkdir -p "${extensions_root}" if [ ! -d "${extensions_root}/${repo_name}" ]; then - git \ - -c credential.helper= \ - -c credential.helper='!gh auth git-credential' \ - clone --depth 1 "https://github.com/${extension}.git" "${extensions_root}/${repo_name}" + if ! gh extension install "${extension}"; then + git \ + -c credential.helper= \ + -c credential.helper='!gh auth git-credential' \ + clone --depth 1 "https://github.com/${extension}.git" "${extensions_root}/${repo_name}" + fi fi } @@ -79,6 +81,12 @@ if [ "$#" -ge 2 ]; then url="${url#ssh://git@github.com/}" url="${url#git@github.com:}" echo "$url" + elif [ -f "$d/manifest.yml" ]; then + owner="$(sed -nE 's/^[[:space:]]*owner:[[:space:]]*"?([^"#]+)"?.*$/\1/p' "$d/manifest.yml" | sed -n '1p')" + name="$(sed -nE 's/^[[:space:]]*name:[[:space:]]*"?([^"#]+)"?.*$/\1/p' "$d/manifest.yml" | sed -n '1p')" + if [ -n "$owner" ] && [ -n "$name" ]; then + echo "$owner/$name" + fi fi done fi diff --git a/test/github-cli/install_extensions.sh b/test/github-cli/install_extensions.sh index 78cb126f9..1538ff3f2 100644 --- a/test/github-cli/install_extensions.sh +++ b/test/github-cli/install_extensions.sh @@ -9,6 +9,8 @@ check "gh-version" gh --version check "gh-extension-installed" gh extension list | grep -q 'dlvhdr/gh-dash' check "gh-extension-installed-2" gh extension list | grep -q 'github/gh-copilot' +check "gh-extension-installed-3" gh extension list | grep -q 'github/gh-aw' +check "gh-aw-runs" gh aw version # Report result reportResults diff --git a/test/github-cli/scenarios.json b/test/github-cli/scenarios.json index eafee3c59..e8b842f96 100644 --- a/test/github-cli/scenarios.json +++ b/test/github-cli/scenarios.json @@ -13,7 +13,7 @@ "features": { "github-cli": { "version": "latest", - "extensions": "dlvhdr/gh-dash,github/gh-copilot" + "extensions": "dlvhdr/gh-dash,github/gh-copilot,github/gh-aw" } } }