diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 5898901464..3f5a1d5380 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -12,14 +12,17 @@ jobs: steps: - shell: bash + env: + REF_NAME: ${{ github.ref_name }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} 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 + echo "branch=$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 + echo "branch=$HEAD_REF" >> $GITHUB_ENV fi - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -27,4 +30,4 @@ jobs: ref: ${{env.branch}} fetch-depth: ${{env.depth}} - name: Scan for secrets - uses: trufflesecurity/trufflehog@6bd2d14f7a4bc1e569fa3550efa7ec632a4fa67b # main + uses: trufflesecurity/trufflehog@6bd2d14f7a4bc1e569fa3550efa7ec632a4fa67b # main \ No newline at end of file