Files
npm-audit-action/README.md
Naoki Oketani 5209022168 support different working directory (#64)
* support different working directory

* validate working_directory
2020-05-23 15:59:51 +09:00

1.7 KiB

npm audit action

Coverage Status

GitHub Action to run npm audit

Feature

Create a Pull Request comment

If vulnerabilities are found by npm audit, Action triggered by PR creates a comment.

Create an Issue

If vulnerabilities are found by npm audit, Action triggered by push, schedule creates the following GitHub Issue.

image

Usage

Inputs

Parameter Required Default Value Description
audit_level false low The value of --audit-level flag
issue_assignees false N/A Issue assignees (separated by commma)
issue_labels false N/A Issue labels (separated by commma)
issue_title false npm audit found vulnerabilities Issue title
token true N/A GitHub Access Token.
${{ secrets.GITHUB_TOKEN }} is recommended.
working_directory false N/A The directory which contains package.json

Outputs

N/A

Example Workflow

name: npm audit

on:
  pull_request:
  push:
    branches:
      - master
      - 'releases/*'
# on:
#   schedule:
#     - cron: '0 10 * * *'

jobs:
  scan:
    name: npm audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: install dependencies
        run: npm ci
      - uses: oke-py/npm-audit-action@v1.3.1
        with:
          audit_level: moderate
          github_token: ${{ secrets.GITHUB_TOKEN }}
          issue_assignees: oke-py
          issue_labels: vulnerability,test

This action is inspired by homoluctus/gitrivy.