Skip to content

Commit

Permalink
ci(codeql): calculate fetch depth
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed Aug 14, 2023
1 parent ec6fcb1 commit bc2a949
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ jobs:
actions: write
contents: read
steps:
- run: |
echo "PUSH_FETCH_DEPTH=$(( $(git rev-list --count ${{ github.event.before }}..${{ github.sha }}) + 1 ))" >> "${GITHUB_ENV}"
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: ${{ env.PUSH_FETCH_DEPTH }}

- name: Check for non-Dependabot commits
run: |
git fetch origin "${{ github.event.before }}..${{ github.sha }}"
if git log --format='%an' ${{ github.event.before }}..${{ github.sha }} | grep "dependabot\[bot\]" &> /dev/null; then
echo "Non-Dependabot commits found. Workflow can continue."
exit 0
Expand Down

0 comments on commit bc2a949

Please sign in to comment.