Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit 4ac6462

Browse files
authored
fix test suite (#6)
* run test suite * test gh command adapted * fix install step * fix installing step * use node16 * split "gh works" test * expression adapted * fix windows gh command check * use cmd for windows step * log tool_cache on macos * gh command check on macos * formatting + build
1 parent 8c85b32 commit 4ac6462

File tree

6 files changed

+35
-8
lines changed

6 files changed

+35
-8
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ updates:
77
- package-ecosystem: "github-actions"
88
directory: "/"
99
schedule:
10-
interval: "weekly"
10+
interval: "weekly"

.github/workflows/test.yaml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,39 @@ jobs:
2424
- name: Install packages
2525
run: npm ci
2626

27+
- name: Run tests
28+
run: npm run test
29+
2730
- name: Build package
2831
run: npm run build
2932

3033
- name: Test installing gh cli
31-
run: node .
32-
env:
34+
id: install
35+
uses: ./
36+
with:
3337
version: 2.28.0
3438

35-
- name: Test gh command works
36-
run: gh --version
39+
- name: Test gh command works on ubuntu
40+
if: matrix.os == 'ubuntu-latest'
41+
env:
42+
INSTALL_OUTPUT: ${{ steps.install.outputs.gh_version }}
43+
run: |
44+
echo "Installed gh version: $INSTALL_OUTPUT"
45+
$RUNNER_TOOL_CACHE/gh/2.28.0/x64/bin/gh --version
46+
47+
- name: Test gh command works on macos
48+
if: matrix.os == 'macos-latest'
49+
env:
50+
INSTALL_OUTPUT: ${{ steps.install.outputs.gh_version }}
51+
run: |
52+
echo "Installed gh version: $INSTALL_OUTPUT"
53+
$RUNNER_TOOL_CACHE/gh/2.28.0/x64/gh_2.28.0_macOS_amd64/bin/gh --version
54+
55+
- name: Test gh command works on windows
56+
if: matrix.os == 'windows-latest'
57+
shell: cmd
58+
env:
59+
INSTALL_OUTPUT: ${{ steps.install.outputs.gh_version }}
60+
run: |
61+
echo "Installed gh version: %INSTALL_OUTPUT%"
62+
%RUNNER_TOOL_CACHE%\gh\2.28.0\x64\bin\gh --version

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# setup-ghcli
2+
23
[![build & test](https://github.com/twildber/setup-ghcli/actions/workflows/test.yaml/badge.svg)](https://github.com/twildber/setup-ghcli/actions/workflows/test.yaml)
34
[![release](https://github.com/twildber/setup-ghcli/actions/workflows/release.yaml/badge.svg)](https://github.com/twildber/setup-ghcli/actions/workflows/release.yaml)
45

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ outputs:
1010
gh_version:
1111
description: "The installed version"
1212
runs:
13-
using: "node18"
13+
using: "node16"
1414
main: "lib/index.js"

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6626,7 +6626,7 @@ async function setup() {
66266626
const version = core.getInput("version");
66276627
const versionSpec = await getValidTag(version);
66286628
await downloadCli(versionSpec, os.arch());
6629-
core.setOutput("gh_version", version);
6629+
core.setOutput("gh_version", versionSpec);
66306630
}
66316631
exports.setup = setup;
66326632

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ export async function setup() {
100100
const versionSpec = await getValidTag(version);
101101

102102
await downloadCli(versionSpec, os.arch());
103-
core.setOutput("gh_version", version);
103+
core.setOutput("gh_version", versionSpec);
104104
}

0 commit comments

Comments
 (0)