Skip to content

Commit 839ebfc

Browse files
authored
feat: Allow testing arbitrary refs (#2)
1 parent b67c474 commit 839ebfc

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

.github/workflows/npm-test.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,52 @@ name: NPM CI - Build and Test
33
on:
44
workflow_call:
55
inputs:
6+
ref:
7+
required: true
8+
type: string
9+
description: Reference (e.g. branch, tag, commit SHA).
610
node-version:
711
required: false
812
default: 24
913
type: number
10-
description: 'Node.js version to use for the build.'
14+
description: Node.js version to use for the build.
1115
pwsh:
1216
required: false
1317
default: true
1418
type: boolean
15-
description: 'Whether to install PowerShell for the build.'
19+
description: Whether to install PowerShell for the build.
1620
build-script:
1721
required: false
18-
default: 'build'
22+
default: build
1923
type: string
20-
description: 'Custom build script to run.'
24+
description: Custom build script to run.
2125
test-script:
2226
required: false
23-
default: 'test'
27+
default: test
2428
type: string
25-
description: 'Custom test script to run.'
29+
description: Custom test script to run.
2630
build:
2731
required: false
2832
default: true
2933
type: boolean
30-
description: 'Whether to run the build step before testing.'
34+
description: Whether to run the build step before testing.
3135

3236
jobs:
3337
build-and-test:
3438
name: Build & Test
3539
runs-on: ubuntu-latest
3640
steps:
37-
- name: Checkout Code
38-
uses: actions/checkout@v4
39-
4041
- name: Set Node.js v${{ inputs.node-version }} Up
4142
uses: actions/setup-node@v4
4243
with:
4344
node-version: ${{ inputs.node-version }}
4445
registry-url: 'https://registry.npmjs.org/'
4546

47+
- name: Checkout Code
48+
uses: actions/checkout@v4
49+
with:
50+
ref: ${{ inputs.ref }}
51+
4652
- name: Install PowerShell
4753
if: inputs.pwsh
4854
uses: PSModule/Install-PowerShell@v1

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ but note that these are not intended for general consumption use.
1717
| `build-script` | `string` | `build` | The name of the script (as defined in package.json) to execute to have the project built. |
1818
| `test-script` | `string` | `test` | The name of the script (as defined in package.json) to execute to have the project tested. |
1919
| `build` | `boolean` | `true` | Whether to build the project or not. |
20+
| `ref` | `string` | | Reference (e.g. branch, tag, commit SHA). |
2021

2122
All inputs are optional.
2223

0 commit comments

Comments
 (0)