Skip to content

Commit cb096d8

Browse files
authored
Fix No assets found in release error (#722)
* Debug tar|zip only download * Add a failing test * Fix no assets found error * Update CI test script * remove default filename * Replace regex based file matching with minimatch lib
1 parent 62178ff commit cb096d8

11 files changed

+2514
-109
lines changed

.github/workflows/ci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ jobs:
5151
shell: bash
5252
run: ls -lrth test-downloads
5353

54+
- name: Download tarBall & zipBall only
55+
uses: ./
56+
with:
57+
repository: "robinraju/probable-potato"
58+
tag: "1.0.2"
59+
tarBall: true
60+
zipBall: true
61+
out-file-path: "./public-download"
62+
63+
- name: List downloaded files
64+
shell: bash
65+
run: ls -lrth public-download
66+
5467
- name: Test download latest pre-release
5568
uses: ./
5669
with:

__tests__/main.test.ts

+40
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ beforeEach(() => {
101101
nock("https://api.github.com/")
102102
.get("/repos/foo/slick-pg/releases")
103103
.reply(200, readFromFile("5-without-prerelease.json"))
104+
105+
nock("https://api.github.com")
106+
.get("/repos/robinraju/tar-zip-ball-only-repo/releases/latest")
107+
.reply(200, readFromFile("6-tar-zip-ball-only-repo.json"))
108+
109+
nock("https://api.github.com", {
110+
reqheaders: {accept: "*/*"}
111+
})
112+
.get("/repos/robinraju/tar-zip-ball-only-repo/tarball/1.0.0")
113+
.replyWithFile(
114+
200,
115+
__dirname + "/resource/assets/tar-zip-ball-only-repo.tar.gz"
116+
)
117+
118+
nock("https://api.github.com", {
119+
reqheaders: {accept: "*/*"}
120+
})
121+
.get("/repos/robinraju/tar-zip-ball-only-repo/zipball/1.0.0")
122+
.replyWithFile(
123+
200,
124+
__dirname + "/resource/assets/tar-zip-ball-only-repo.zip"
125+
)
104126
})
105127

106128
afterEach(async () => {
@@ -384,3 +406,21 @@ test("Fail when a release with no prerelease is obtained", async () => {
384406
const result = downloader.download(downloadSettings)
385407
await expect(result).rejects.toThrow("No prereleases found!")
386408
}, 10000)
409+
410+
test("Download from a release containing only tarBall & zipBall", async () => {
411+
const downloadSettings: IReleaseDownloadSettings = {
412+
sourceRepoPath: "robinraju/tar-zip-ball-only-repo",
413+
isLatest: true,
414+
preRelease: false,
415+
tag: "",
416+
id: "",
417+
fileName: "",
418+
tarBall: true,
419+
zipBall: true,
420+
extractAssets: false,
421+
outFilePath: outputFilePath
422+
}
423+
424+
const result = await downloader.download(downloadSettings)
425+
expect(result.length).toBe(2)
426+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"url": "https://api.github.com/repos/robinraju/tar-zip-ball-only-repo/releases/68092192",
3+
"assets_url": "https://api.github.com/repos/robinraju/tar-zip-ball-only-repo/releases/68092192/assets",
4+
"upload_url": "https://uploads.github.com/repos/robinraju/tar-zip-ball-only-repo/releases/68092192/assets{?name,label}",
5+
"html_url": "https://github.com/robinraju/tar-zip-ball-only-repo/releases/tag/1.0.0",
6+
"id": 68092192,
7+
"author": {},
8+
"node_id": "RE_kwDOHahpL84EDwEf",
9+
"tag_name": "1.0.0",
10+
"target_commitish": "main",
11+
"name": "Release 1.0.0",
12+
"draft": false,
13+
"prerelease": false,
14+
"created_at": "2024-04-24T12:03:47Z",
15+
"published_at": "2024-04-24T12:04:42Z",
16+
"assets": [],
17+
"tarball_url": "https://api.github.com/repos/robinraju/tar-zip-ball-only-repo/tarball/1.0.0",
18+
"zipball_url": "https://api.github.com/repos/robinraju/tar-zip-ball-only-repo/zipball/1.0.0",
19+
"body": ""
20+
}
Binary file not shown.
1020 Bytes
Binary file not shown.

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ inputs:
2020
required: false
2121
fileName:
2222
description: "Name of the file to download (use '*' to download all assets other than tarball or zipball)"
23-
default: "*"
23+
default: ""
2424
required: false
2525
tarBall:
2626
description: "Download tarball from assets"

0 commit comments

Comments
 (0)