name: build

on: [push, pull_request]

jobs:
  test:
    name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        node-version: [12.x, 14.x, 16.x, 18.x]
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        cache: 'npm'
        node-version: ${{ matrix.node-version }}
    # Use separate run commands so command status handled correctly on Windows
    - name: npm install
      run: npm ci
    - name: npm test
      run: npm test
    - name: npm run lint
      run: npm run lint

name: build

on: [push, pull_request]

permissions:
  contents: read

jobs:
  test:
    name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        node-version: [12.x, 14.x, 16.x, 18.x]
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        cache: 'npm'
        node-version: ${{ matrix.node-version }}
    # Use separate run commands so command status handled correctly on Windows
    - name: npm install
      run: npm ci
    - name: npm test
      run: npm test
    - name: npm run lint
      run: npm run lint

Set permissions for GitHub actions
chore: Set permissions for GitHub actions

 Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: neilnaveen <78c59589e676141b34fb8a7070e7f4c278d0ae10@users.noreply.github.com>
