Test do not merge #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Detect Secrets Scan | |
on: | |
workflow_dispatch: | |
pull_request: | |
env: | |
exclude: '' | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
detect-secrets: | |
name: Detect Secrets Scan | |
runs-on: ubuntu-latest | |
container: | |
image: python:latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Change Owner of Container Working Directory | |
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: | | |
git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline ${{ env.exclude_args }} * --json > /tmp/secrets.json | |
- name: Show detect-secrets output | |
if: success() || failure() | |
run: cat /tmp/secrets.json | |
- name: Show detect-secrets differences | |
if: ${{ failure() }} | |
run: git diff |