From 348e2294ac1a3cc744a93f04ab1f886439ee90d3 Mon Sep 17 00:00:00 2001 From: Luc Georges Date: Wed, 12 Jun 2024 18:00:43 +0200 Subject: [PATCH] feat(ci): add trufflehog secrets detection (#31344) --- .github/workflows/trufflehog.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/trufflehog.yml diff --git a/.github/workflows/trufflehog.yml b/.github/workflows/trufflehog.yml new file mode 100644 index 0000000000..7dde546224 --- /dev/null +++ b/.github/workflows/trufflehog.yml @@ -0,0 +1,29 @@ +on: + push: + +name: Secret Leaks + +permissions: + contents: read + +jobs: + trufflehog: + runs-on: ubuntu-latest + steps: + - shell: bash + run: | + if [ "${{ github.event_name }}" == "push" ]; then + echo "depth=$(($(jq length <<< '${{ toJson(github.event.commits) }}') + 2))" >> $GITHUB_ENV + echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV + fi + if [ "${{ github.event_name }}" == "pull_request" ]; then + echo "depth=$((${{ github.event.pull_request.commits }}+2))" >> $GITHUB_ENV + echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV + fi + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{env.branch}} + fetch-depth: ${{env.depth}} + - name: Secret Scanning + uses: trufflesecurity/trufflehog@main