From aa169a123e6a1100c7b33544d459a42219c4575f Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Thu, 17 Jul 2025 12:16:19 +0200 Subject: [PATCH] Actions(trufflehog): Fix for external PRs (#108215) --- .github/workflows/trufflehog.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/trufflehog.yml b/.github/workflows/trufflehog.yml index 4b5707d6a23..057a708c129 100644 --- a/.github/workflows/trufflehog.yml +++ b/.github/workflows/trufflehog.yml @@ -21,15 +21,17 @@ jobs: contents: read # clone the repo steps: + - name: Calculate fetch depth + id: fetch_depth + shell: bash + run: echo "fetch_depth=$(( ${{ github.event.pull_request.commits }} + 2 ))" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v4 with: persist-credentials: false - fetch-depth: 0 - ref: ${{ github.head_ref }} + fetch-depth: ${{ steps.fetch_depth.outputs.fetch_depth }} + ref: ${{ github.event.pull_request.head.ref }} - name: Trufflehog uses: trufflesecurity/trufflehog@eafb8c5f6a06175141c27f17bcc17941853d0047 # v3.90.0 with: - base: ${{ github.event.pull_request.base.sha }} - head: ${{ github.event.pull_request.head.sha }} extra_args: --results=verified