From 1dbd73f3af7997428b1029b5b265964bfbdd0a9c Mon Sep 17 00:00:00 2001 From: CharlieM <31941002+CharlieMc0@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:12:55 -0600 Subject: [PATCH] diff regex --- .github/workflows/sast-linters.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml index d8f3e64094..060d545e11 100644 --- a/.github/workflows/sast-linters.yml +++ b/.github/workflows/sast-linters.yml @@ -184,8 +184,10 @@ jobs: labels: ["nosec"] }) - - name: Check for pattern + - name: Check for '#nosec' without specificed rule run: | DIFF=$(git diff ${{ github.event.pull_request.base.sha }}) - echo "$DIFF" | grep -P '#nosec(?!(\sG\d{3}))(?![^\s\t])([\s\t]*|$)' && echo "Pattern found!" || echo "Pattern not found!" + echo "$DIFF" | grep -P '#nosec(?!(\sG\d{3}))(?![^\s\t])([\s\t]*|$)' && echo "nosec without specificed rule found!" && exit 1 || exit 0 + + \ No newline at end of file