Skip to content

Commit

Permalink
Merge branch 'actions:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
HarithaVattikuti authored May 10, 2024
2 parents 6d59f54 + c2ac33f commit af3f2cb
Show file tree
Hide file tree
Showing 15 changed files with 1,835 additions and 729 deletions.
2 changes: 1 addition & 1 deletion .licenses/npm/@actions/cache.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .licenses/npm/@actions/http-client.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .licenses/npm/@types/node.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .licenses/npm/undici-types.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .licenses/npm/undici.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The `node-version` input supports the Semantic Versioning Specification, for mor

Examples:

- Major versions: `16`, `18`, `20`
- Major versions: `18`, `20`
- More specific versions: `10.15`, `16.15.1` , `18.4.0`
- NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n`
- Latest release: `*` or `latest`/`current`/`node`
Expand Down Expand Up @@ -135,7 +135,7 @@ steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm test
Expand All @@ -148,7 +148,7 @@ steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: 'npm'
cache-dependency-path: subdir/package-lock.json
- run: npm ci
Expand Down Expand Up @@ -185,7 +185,7 @@ To get a higher rate limit, you can [generate a personal access token on github.
uses: actions/setup-node@v4
with:
token: ${{ secrets.GH_DOTCOM_TOKEN }}
node-version: 16
node-version: 20
```

If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.
Expand Down
11 changes: 11 additions & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as tc from '@actions/tool-cache';
import * as cache from '@actions/cache';
import * as io from '@actions/io';

import fs from 'fs';
import path from 'path';
Expand All @@ -24,6 +25,10 @@ describe('main tests', () => {
let startGroupSpy: jest.SpyInstance;
let endGroupSpy: jest.SpyInstance;

let whichSpy: jest.SpyInstance;

let existsSpy: jest.SpyInstance;

let getExecOutputSpy: jest.SpyInstance;

let getNodeVersionFromFileSpy: jest.SpyInstance;
Expand Down Expand Up @@ -55,6 +60,8 @@ describe('main tests', () => {
inSpy = jest.spyOn(core, 'getInput');
inSpy.mockImplementation(name => inputs[name]);

whichSpy = jest.spyOn(io, 'which');

getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');

findSpy = jest.spyOn(tc, 'find');
Expand Down Expand Up @@ -140,6 +147,10 @@ describe('main tests', () => {
return {stdout: obj[command], stderr: '', exitCode: 0};
});

whichSpy.mockImplementation(cmd => {
return `some/${cmd}/path`;
});

await util.printEnvDetailsAndSetOutput();

expect(setOutputSpy).toHaveBeenCalledWith('node-version', obj['node']);
Expand Down
3 changes: 3 additions & 0 deletions __tests__/official-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ describe('setup-node', () => {
const toolPath = path.normalize('/cache/node/12.16.2/x64');
exSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
whichSpy.mockImplementation(cmd => {
return `some/${cmd}/path`;
});

await main.run();

Expand Down
Loading

0 comments on commit af3f2cb

Please sign in to comment.