Skip to content

Commit 0fc99a3

Browse files
authored
Merge pull request #90 from DeLaGuardo/cli-gh-releases
Check if GH release provide needed asset
2 parents 15c9fc8 + 7a348ad commit 0fc99a3

File tree

6 files changed

+31
-9
lines changed

6 files changed

+31
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
java-version: '8'
4747

4848
- name: Install clojure tools
49-
uses: DeLaGuardo/setup-clojure@12.0
49+
uses: DeLaGuardo/setup-clojure@12.1
5050
with:
5151
# Install just one or all simultaneously
5252
# The value must indicate a particular version of the tool, or use 'latest'

dist/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,23 @@ function toolVersion(version, githubAuth) {
414414
}
415415
});
416416
}
417+
function isResourceProvided(target, assets) {
418+
for (const asset of assets) {
419+
if (asset.browser_download_url === target) {
420+
return true;
421+
}
422+
}
423+
return false;
424+
}
417425
function getUrls(tag, githubAuth) {
418426
var _a;
419427
return __awaiter(this, void 0, void 0, function* () {
420428
const res = yield client.getJson(`https://api.github.com/repos/clojure/brew-install/releases/tags/${tag}`, githubAuth ? { Authorization: githubAuth } : undefined);
429+
const posix_install_url = `https://github.com/clojure/brew-install/releases/download/${tag}/posix-install.sh`;
421430
const assets = (_a = res.result) === null || _a === void 0 ? void 0 : _a.assets;
422-
if (assets) {
431+
if (assets && isResourceProvided(posix_install_url, assets)) {
423432
return {
424-
posix: `https://github.com/clojure/brew-install/releases/download/${tag}/posix-install.sh`,
433+
posix: posix_install_url,
425434
linux: `https://github.com/clojure/brew-install/releases/download/${tag}/linux-install.sh`,
426435
windows: `github.com/clojure/brew-install/releases/download/${tag}/win-install.ps1`
427436
};
@@ -1292,7 +1301,7 @@ exports.isMacOS = isMacOS;
12921301

12931302
Object.defineProperty(exports, "__esModule", ({ value: true }));
12941303
exports.VERSION = void 0;
1295-
exports.VERSION = '12-0';
1304+
exports.VERSION = '12-1';
12961305

12971306

12981307
/***/ }),

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-clojure",
3-
"version": "12.0",
3+
"version": "12.1",
44
"private": true,
55
"description": "setup clojure action",
66
"main": "lib/setup-clojure.js",

src/cli.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ async function toolVersion(
3535
}
3636
}
3737

38+
function isResourceProvided(
39+
target: string,
40+
assets: {browser_download_url: string}[]
41+
): boolean {
42+
for (const asset of assets) {
43+
if (asset.browser_download_url === target) {
44+
return true
45+
}
46+
}
47+
return false
48+
}
49+
3850
async function getUrls(
3951
tag: string,
4052
githubAuth?: string
@@ -45,11 +57,12 @@ async function getUrls(
4557
`https://api.github.com/repos/clojure/brew-install/releases/tags/${tag}`,
4658
githubAuth ? {Authorization: githubAuth} : undefined
4759
)
60+
const posix_install_url = `https://github.com/clojure/brew-install/releases/download/${tag}/posix-install.sh`
4861

4962
const assets = res.result?.assets
50-
if (assets) {
63+
if (assets && isResourceProvided(posix_install_url, assets)) {
5164
return {
52-
posix: `https://github.com/clojure/brew-install/releases/download/${tag}/posix-install.sh`,
65+
posix: posix_install_url,
5366
linux: `https://github.com/clojure/brew-install/releases/download/${tag}/linux-install.sh`,
5467
windows: `github.com/clojure/brew-install/releases/download/${tag}/win-install.ps1`
5568
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '12-0'
1+
export const VERSION = '12-1'

0 commit comments

Comments
 (0)