Skip to content

Commit

Permalink
Simplify detect-secrets.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ArisBee authored Sep 24, 2024
1 parent 2b4ea83 commit 0478648
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/detect-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Detect Secrets Scan
on:
workflow_dispatch:
pull_request:
env:
exclude: ''

permissions:
contents: read
Expand All @@ -23,22 +21,7 @@ jobs:
run: chown root:root .
- name: Install detect-secrets
run: pip install detect-secrets
- name: Set --exclude-files arguments
if: ${{ env.exclude }} != ''
shell: bash
run: |
# Use a loop to parse the values in the exclude input and build the desired string
exclude_args=""
IFS=' ' read -a arr <<< $exclude
for ex in "${arr[@]}"
do
exclude_args="${exclude_args} --exclude-files '${ex}'"
done
echo "exclude_args=${exclude_args}" >> $GITHUB_ENV
- name: Run detect-secrets-hook
shell: bash
run: |
detect-secrets-hook --baseline .secrets.baseline ${{ env.exclude_args }} * --json > /tmp/secrets.json
- name: Show detect-secrets differences
if: ${{ failure() }}
run: git diff
git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline *

0 comments on commit 0478648

Please sign in to comment.