[StepSecurity] Apply security best practices #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
ci: | |
name: Building, linting, testing on node ${{ matrix.node }} and ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node: ['20.x'] | |
os: [ubuntu-latest] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout repo | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- name: Use Node ${{ matrix.node }} | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 | |
with: | |
node-version: ${{ matrix.node }} | |
# Optionally, use the latest npm version if appropriate | |
- name: Setup latest npm version | |
run: npm install -g npm@latest # Ensure you need this specific npm version | |
- name: Install project dependencies | |
run: npm instal | |
- name: Install deps and build (with cache) | |
uses: bahmutov/npm-install@e5c7e14408aa6089501de32bd16123b41738047e # v1.10.2 | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm test -- --ci --coverage --maxWorkers=2 | |
- name: Build | |
run: npm run build |