Skip to content

Commit 79a471a

Browse files
refactor: move base branch filter to on: block
Moved the 'targets main' check from job if: to workflow on.pull_request.branches. This prevents the workflow from even triggering for PRs targeting other branches, saving CI resources. Draft check is implicit in the types list (opened + ready_for_review). Fork check must stay in if: condition (can't be filtered in on: block).
1 parent 34b6b26 commit 79a471a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.github/workflows/auto-fix-licenses.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ name: Auto-fix License Files
77
on:
88
pull_request:
99
types: [synchronize, opened, reopened, ready_for_review]
10+
branches:
11+
- main # Only run when PR targets main
1012
paths:
1113
- "**.go"
1214
- go.mod
@@ -19,11 +21,8 @@ permissions:
1921
jobs:
2022
auto-fix-licenses:
2123
runs-on: ubuntu-latest
22-
# Only run on PRs targeting main, from same repo, not drafts
23-
if: |
24-
github.event.pull_request.base.ref == 'main' &&
25-
github.event.pull_request.head.repo.full_name == github.repository &&
26-
github.event.pull_request.draft == false
24+
# Only run on PRs from same repo (not forks)
25+
if: github.event.pull_request.head.repo.full_name == github.repository
2726

2827
steps:
2928
- name: Check out base PR branch

.github/workflows/license-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
name: License Check
55
on:
66
pull_request:
7+
branches:
8+
- main # Only run when PR targets main
79
paths:
810
- "**.go"
911
- go.mod

0 commit comments

Comments
 (0)