diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3035dad0..9c981f9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,9 @@ jobs: - macos-latest - ubuntu-latest - windows-latest + cache: + - true + - false runs-on: ${{ matrix.os }} steps: - name: ๐Ÿ— Setup repo @@ -26,9 +29,9 @@ jobs: uses: ./ with: eas-version: latest - eas-cache: true + eas-cache: ${{ matrix.cache }} expo-version: latest - expo-cache: true + expo-cache: ${{ matrix.cache }} token: ${{ secrets.EXPO_TOKEN }} - name: ๐Ÿงช EAS installed diff --git a/build/setup/index.js b/build/setup/index.js index 22e37df1..8809a9e7 100644 --- a/build/setup/index.js +++ b/build/setup/index.js @@ -64755,6 +64755,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.executeAction = exports.expoAuthenticate = exports.patchWatchers = exports.installToolFromPackage = exports.toolPath = exports.tempPath = exports.cacheTool = exports.findTool = void 0; const core_1 = __nccwpck_require__(2186); const exec_1 = __nccwpck_require__(1514); +const io_1 = __nccwpck_require__(7436); const os_1 = __importDefault(__nccwpck_require__(2037)); const path_1 = __importDefault(__nccwpck_require__(1017)); var tool_cache_1 = __nccwpck_require__(7784); @@ -64825,7 +64826,7 @@ async function expoAuthenticate(token, cli) { (0, core_1.info)(`Skipped token validation: no CLI installed, can't run 'whoami'.`); } else { - await (0, exec_1.exec)('npx --no-install', [cli, 'whoami'], { + await (0, exec_1.exec)(await (0, io_1.which)(cli), ['whoami'], { env: { ...process.env, EXPO_TOKEN: token }, }); } diff --git a/src/worker.ts b/src/worker.ts index 23a22bc4..eca2c4d3 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -1,5 +1,6 @@ import { addPath, exportVariable, info, setFailed, warning } from '@actions/core'; import { exec } from '@actions/exec'; +import { which } from '@actions/io'; import os from 'os'; import path from 'path'; @@ -71,7 +72,7 @@ export async function expoAuthenticate(token: string, cli?: 'expo' | 'eas'): Pro if (!cli) { info(`Skipped token validation: no CLI installed, can't run 'whoami'.`); } else { - await exec('npx --no-install', [cli, 'whoami'], { + await exec(await which(cli), ['whoami'], { env: { ...process.env, EXPO_TOKEN: token }, }); } diff --git a/tests/worker.test.ts b/tests/worker.test.ts index 7a885e0f..dc791849 100644 --- a/tests/worker.test.ts +++ b/tests/worker.test.ts @@ -1,5 +1,6 @@ import * as core from '@actions/core'; import * as exec from '@actions/exec'; +import * as io from '@actions/io'; import os from 'os'; import path from 'path'; @@ -15,6 +16,7 @@ import { resetEnv, setEnv, setPlatform, resetPlatform } from './utils'; jest.mock('@actions/core'); jest.mock('@actions/exec'); +jest.mock('@actions/io'); describe(tempPath, () => { afterEach(resetEnv); @@ -93,15 +95,19 @@ describe(expoAuthenticate, () => { }); it('validates EXPO_TOKEN with expo-cli', async () => { + jest.mocked(io.which).mockResolvedValue('expo'); await expoAuthenticate('faketoken', 'expo'); - expect(exec.exec).toBeCalledWith('npx --no-install', ['expo', 'whoami'], { + expect(io.which).toBeCalledWith('expo'); + expect(exec.exec).toBeCalledWith('expo', ['whoami'], { env: expect.objectContaining({ EXPO_TOKEN: 'faketoken' }), }); }); it('validates EXPO_TOKEN with eas-cli', async () => { + jest.mocked(io.which).mockResolvedValue('eas'); await expoAuthenticate('faketoken', 'eas'); - expect(exec.exec).toBeCalledWith('npx --no-install', ['eas', 'whoami'], { + expect(io.which).toBeCalledWith('eas'); + expect(exec.exec).toBeCalledWith('eas', ['whoami'], { env: expect.objectContaining({ EXPO_TOKEN: 'faketoken' }), }); });