File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 2727
2828 - name : Create or update reminder issue
2929 if : steps.audit.outcome == 'failure'
30- uses : actions/github-script@v7
30+ uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
3131 env :
3232 TZ : ' Asia/Tokyo'
3333 with :
Original file line number Diff line number Diff line change 1- find . -name package-lock.json \
2- -not -path " ./node_modules/*" \
3- -execdir sh -c '
4- printf "\033[1;34m==> %s\033[0m\n" "$PWD"
5- npm audit fix --force
6- ' \;
7-
8- if [ -n " $( git status --porcelain) " ]; then
9- echo " Changes detected after 'npm audit fix'"
10- exit 1
1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ errors=0
5+
6+ find . -name package-lock.json -not -path " ./node_modules/*" -print0 |
7+ xargs -0 -n1 dirname | sort -u |
8+ while IFS= read -r dir; do
9+ printf ' \n\n\n'
10+ printf ' \033[1;34m==> %s\033[0m\n' " $dir "
11+ (cd " $dir " && npm audit) || errors=1
12+ done
13+
14+ if [ " $errors " -eq 0 ]; then
15+ echo " npm audit passed: no vulnerabilities detected"
1116else
12- echo " No changes detected after 'npm audit fix' "
17+ echo " npm audit reported vulnerabilities. Fix all vulnerabilities before committing. "
1318fi
19+
20+ exit " $errors "
You can’t perform that action at this time.
0 commit comments