Skip to content

Commit 4eb4cf0

Browse files
authored
chore: Skip CD pipelines on Depandabot's PRs (#7)
* chore: Skip CD pipelines on Dependabot's PRs * fix: Skip Gitleaks check on forks as they don't have the license key * fix: forgotten conflict in CI
1 parent 1b4d41d commit 4eb4cf0

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

.github/workflows/cd.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
build-and-push-artifacts:
3131
name: Build and push artifacts for Python ${{ matrix.python_version }}
3232
runs-on: ubuntu-latest
33-
# Only run for base repo, not forks
34-
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
33+
# Only run for base repo, not forks or dependabot
34+
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && github.actor != 'dependabot[bot]'
3535
strategy:
3636
fail-fast: false
3737
matrix:
@@ -122,8 +122,8 @@ jobs:
122122
name: All artifacts pushed
123123
runs-on: ubuntu-latest
124124
needs: build-and-push-artifacts
125-
# Only run if the build job ran (i.e., not for forks)
126-
if: always() && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request')
125+
# Only run if the build job ran (i.e., not for forks or dependabot)
126+
if: always() && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && github.actor != 'dependabot[bot]'
127127
steps:
128128
- name: Check matrix job results
129129
env:
@@ -144,8 +144,8 @@ jobs:
144144
publish-python-package:
145145
name: Publish Python package
146146
runs-on: ubuntu-latest
147-
# Only run for base repo, not forks
148-
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
147+
# Only run for base repo, not forks or dependabot
148+
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && github.actor != 'dependabot[bot]'
149149
outputs:
150150
version: ${{ steps.build.outputs.version }}
151151
permissions:
@@ -284,8 +284,8 @@ jobs:
284284
name: Publish to PyPI
285285
runs-on: ubuntu-latest
286286
needs: publish-python-package
287-
# Only run for base repo when a new tag is created
288-
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && startsWith(github.ref, 'refs/tags/')
287+
# Only run for base repo when a new tag is created, not for dependabot
288+
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && startsWith(github.ref, 'refs/tags/') && github.actor != 'dependabot[bot]'
289289
permissions:
290290
contents: read
291291
id-token: write
@@ -308,8 +308,8 @@ jobs:
308308
name: Deploy review app
309309
runs-on: ubuntu-latest
310310
needs: build-and-push-artifacts-status
311-
# Only run for base repo PRs, not forks
312-
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
311+
# Only run for base repo PRs, not forks or dependabot
312+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
313313
steps:
314314
- name: Checkout code
315315
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
@@ -353,8 +353,8 @@ jobs:
353353
name: Jupyter for local
354354
runs-on: ubuntu-latest
355355
needs: build-and-push-artifacts-status
356-
# Only run for base repo, not forks
357-
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
356+
# Only run for base repo, not forks or dependabot
357+
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') && github.actor != 'dependabot[bot]'
358358
permissions:
359359
id-token: write
360360
contents: read

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ jobs:
217217
gitleaks:
218218
name: Gitleaks check
219219
runs-on: ubuntu-latest
220+
# Only run for base repo, not forks
221+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
220222
steps:
221223
- name: Checkout code
222224
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4

0 commit comments

Comments
 (0)