@@ -35,7 +35,7 @@ concurrency:
3535 cancel-in-progress : false
3636
3737permissions :
38- contents : read
38+ contents : write # needed to read draft release assets when called from publish.yml
3939
4040jobs :
4141 smoke-test :
@@ -77,18 +77,31 @@ jobs:
7777 exit 1
7878 fi
7979
80- - name : Resolve CLI version
80+ - name : Resolve CLI asset URL
8181 id : cli
82+ env :
83+ GH_TOKEN : ${{ github.token }}
8284 run : |
8385 VERSION="${{ inputs.cli_version }}"
84- if [[ -n "$VERSION" ]]; then
85- URL="https://github.com/Kilo-Org/kilocode/releases/download/v${VERSION}/kilo-linux-x64.tar.gz"
86- echo "cli_url=$URL" >> "$GITHUB_OUTPUT"
87- echo "::notice::Testing CLI v${VERSION} from release: $URL"
88- else
86+ if [[ -z "$VERSION" ]]; then
8987 echo "cli_url=" >> "$GITHUB_OUTPUT"
9088 echo "::notice::Testing latest CLI from npm"
89+ exit 0
90+ fi
91+ # Resolve the release asset via the API so this works for draft
92+ # releases too (browser /releases/download/... URLs 404 on drafts).
93+ # The installer passes Accept: application/octet-stream + bearer
94+ # auth, which is what the API asset endpoint expects.
95+ # The tag_name filter yields at most one release and one asset,
96+ # so --jq returns a single URL without needing head/pipefail games.
97+ URL=$(gh api "repos/${{ github.repository }}/releases" \
98+ --jq ".[] | select(.tag_name == \"v${VERSION}\") | .assets[] | select(.name == \"kilo-linux-x64.tar.gz\") | .url")
99+ if [[ -z "$URL" ]]; then
100+ echo "::error::asset kilo-linux-x64.tar.gz not found for v${VERSION}"
101+ exit 1
91102 fi
103+ echo "cli_url=$URL" >> "$GITHUB_OUTPUT"
104+ echo "::notice::Testing CLI v${VERSION} via asset API: $URL"
92105
93106 - name : Run smoke test — hello-world
94107 env :
0 commit comments