Skip to content

Workflow file for this run

name: "Test Action"
on:
workflow_call:
inputs:
node_registry_url:
description: 'The Node.js registry URL'
required: false
type: string
node_version:
description: 'The Node.js version to use'
required: false
default: '22'
type: string
node_scope:
description: 'The Node.js scope'
required: false
type: string
node_cache:
description: 'The Node.js cache argument'
required: false
default: 'npm'
type: string
install_workspaces:
description: 'Appending arguemnts to `npm ci` command to minimize workspace dependency installs. i.e. `-w packages/test -w packages/test2`'
required: false
default: ''
type: string
build_run_script:
description: 'Build command to run.'
required: false
default: ''
type: string
test_run_script:
description: 'Test command to run; defaults to `npm run test`'
required: false
default: npm run test
type: string
secrets:
- NODE_AUTH_TOKEN
jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: ${{ inputs.node_cache }}
registry-url: ${{ inputs.node_registry_url }}
scope: ${{ inputs.node_scope }}
- name: Install Dependencies
run: npm ci "${{ inputs.install_workspaces }}"
env:
# This is the write access auth token for the npm registry; often just simply secrets.GITHUB_TOKEN
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Build
if: ${{ inputs.build_run_script != '' }}
run: npm run "${{ inputs.build_run_script }}"
- run: npm run "${{ inputs.test_run_script }}"