Skip to content

Commit 08a21d7

Browse files
authored
Merge pull request #9160 from Kilo-Org/fix/smoke-test-draft-release
ci: resolve draft release assets via API in smoke-test
2 parents a2ddeba + 8ea33da commit 08a21d7

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ jobs:
261261
needs:
262262
- version
263263
- build-cli
264-
if: false # Disable the smoketest job until it works when called on draft releases
264+
if: github.repository == 'Kilo-Org/kilocode'
265265
uses: ./.github/workflows/smoke-test.yml
266266
with:
267267
cli_version: ${{ needs.version.outputs.version }}
@@ -272,7 +272,7 @@ jobs:
272272
- version
273273
- build-cli
274274
- build-vscode
275-
# - smoke-test # Disable the smoketest job until it works when called on draft releases
275+
- smoke-test
276276
# - build-tauri
277277
runs-on: ubuntu-24.04
278278
steps:

.github/workflows/smoke-test.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ concurrency:
3535
cancel-in-progress: false
3636

3737
permissions:
38-
contents: read
38+
contents: write # needed to read draft release assets when called from publish.yml
3939

4040
jobs:
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

Comments
 (0)