feat(ci): set fetch-depth: 0 in trufflehog checkout step (#31663)

This commit is contained in:
Luc Georges 2024-07-30 14:49:26 +02:00 committed by GitHub
parent 20528f067c
commit 084b5094eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,20 +10,9 @@ jobs:
trufflehog: trufflehog:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- shell: bash - name: Checkout code
run: | uses: actions/checkout@v4
if [ "${{ github.event_name }}" == "push" ]; then with:
echo "depth=$(($(jq length <<< '${{ toJson(github.event.commits) }}') + 2))" >> $GITHUB_ENV fetch-depth: 0
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV - name: Secret Scanning
fi uses: trufflesecurity/trufflehog@main
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