Skip to content

Commit 53a951b

Browse files
committed
🔧 GitHub action condition for push and pull_request
This prevents the checks from being executed twice for internal pull requests.
1 parent 06a06ae commit 53a951b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/pre-commit.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44

55
name: pre-commit
66

7-
on:
8-
pull_request:
9-
push:
10-
branches: [main]
7+
on: [push, pull_request]
118

129
jobs:
1310
pre-commit:
11+
# External pull requests should be checked, but not our own internal pull
12+
# requests again, as these are already checked by the push on the branch.
13+
# Without this if condition, the checks would be performed twice, as
14+
# internal pull requests correspond to both the push and pull_request
15+
# events.
16+
if:
17+
github.event_name == 'push' ||
18+
github.event.pull_request.head.repo.full_name != github.repository
1419
runs-on: ubuntu-latest
1520
steps:
1621
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)