Skip to content

Commit 8a1c299

Browse files
ci: skip CI for fork, draft, and work-in-progress PRs (#259)
## Summary Add workflow guards to prevent unnecessary CI runs and reduce noise: - **Fork-internal PRs**: CI no longer triggers when running inside a fork repository (fork→upstream PRs still trigger normally) - **Draft PRs**: CI skips draft PRs entirely - **WIP PRs**: CI skips PRs with `WIP` or `wip` in the title - **ready_for_review**: CI re-triggers automatically when a draft PR is marked as ready - **Feishu notification**: Skip notification when CI conclusion is `skipped` ## Changed files | File | Change | |------|--------| | `.github/workflows/ci.yml` | Add `ready_for_review` type; guard on `lint` job (gates entire pipeline) | | `.github/workflows/code-scan.yml` | Add `ready_for_review` type; guards on `codeql` and `dependency-review` jobs | | `.github/workflows/labeler.yml` | Add `ready_for_review` type; guard on `label` job | | `.github/workflows/notify-feishu.yml` | Skip notification when `workflow_run.conclusion == 'skipped'` | ## How it works The guard condition uses `github.repository == 'flagos-ai/vllm-plugin-FL'` to distinguish fork-internal runs from upstream runs: - **Fork-internal PR** (e.g. fork's feature → fork's main): workflow runs in the fork repo → condition is false → CI skipped - **Fork→upstream PR**: workflow runs in upstream repo → condition is true → CI runs normally - **Upstream-internal PR**: same as above → CI runs normally For `ci.yml`, the guard is placed only on the `lint` job. Since all downstream jobs (`build`, `discover`, `test-*`) chain via `needs: lint`, skipping `lint` skips the entire pipeline. Reusable workflows (`_lint.yml`, `_build_wheel.yml`, etc.) don't need changes since they are invoked via `workflow_call` and inherit the caller's filtering. For example: <img width="1359" height="173" alt="screenshot-20260701-180959" src="https://github.com/user-attachments/assets/37456a4b-83e6-486e-989f-32a72148fc12" /> such prs in draft status will not trigger ci, as long as those with "wip" in the title <img width="1389" height="710" alt="image" src="https://github.com/user-attachments/assets/ab503167-1b74-4b8b-9d8c-0b2d4bcfb651" /> after click ready for review, workflow will detect status and trigger ci
1 parent 9dded24 commit 8a1c299

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ on:
2222
- cron: '0 18 * * *' # daily at 2:00 AM CST (UTC+8)
2323
pull_request:
2424
branches: [main, devops]
25+
types: [opened, synchronize, reopened, ready_for_review]
2526
paths-ignore:
2627
- "**.md"
2728
- "docs/**"
@@ -42,6 +43,15 @@ jobs:
4243
# Runs on every push/PR. Fast, no special requirements.
4344
# ============================================================
4445
lint:
46+
# Skip: fork-internal PRs, draft PRs, PRs with WIP/wip in title
47+
if: |
48+
github.event_name != 'pull_request' ||
49+
(
50+
github.repository == 'flagos-ai/vllm-plugin-FL' &&
51+
!github.event.pull_request.draft &&
52+
!contains(github.event.pull_request.title, 'WIP') &&
53+
!contains(github.event.pull_request.title, 'wip')
54+
)
4555
uses: ./.github/workflows/_lint.yml
4656

4757
# ============================================================

.github/workflows/code-scan.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ name: Code Scan
1717
on:
1818
pull_request:
1919
branches: [main, devops]
20+
types: [opened, synchronize, reopened, ready_for_review]
2021
paths-ignore:
2122
- "**.md"
2223
- "docs/**"
@@ -42,6 +43,12 @@ jobs:
4243
# ============================================================
4344
codeql:
4445
name: CodeQL Analysis
46+
# Skip: fork-internal PRs, draft PRs, PRs with WIP/wip in title
47+
if: |
48+
github.repository == 'flagos-ai/vllm-plugin-FL' &&
49+
!github.event.pull_request.draft &&
50+
!contains(github.event.pull_request.title, 'WIP') &&
51+
!contains(github.event.pull_request.title, 'wip')
4552
runs-on: ubuntu-latest
4653
steps:
4754
- name: Checkout (attempt 1)
@@ -75,8 +82,14 @@ jobs:
7582
# ============================================================
7683
dependency-review:
7784
name: Dependency Review
85+
# Skip: fork-internal PRs, draft PRs, PRs with WIP/wip in title
86+
if: |
87+
github.event_name == 'pull_request' &&
88+
github.repository == 'flagos-ai/vllm-plugin-FL' &&
89+
!github.event.pull_request.draft &&
90+
!contains(github.event.pull_request.title, 'WIP') &&
91+
!contains(github.event.pull_request.title, 'wip')
7892
runs-on: ubuntu-latest
79-
if: github.event_name == 'pull_request'
8093
steps:
8194
- name: Checkout (attempt 1)
8295
id: checkout1

.github/workflows/labeler.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ name: "Pull Request Labeler"
1616

1717
on:
1818
pull_request_target:
19-
types: [opened, synchronize, reopened]
19+
types: [opened, synchronize, reopened, ready_for_review]
2020

2121
permissions:
2222
contents: read
2323
pull-requests: write
2424

2525
jobs:
2626
label:
27+
# Skip: fork-internal PRs, draft PRs, PRs with WIP/wip in title
28+
if: |
29+
github.repository == 'flagos-ai/vllm-plugin-FL' &&
30+
!github.event.pull_request.draft &&
31+
!contains(github.event.pull_request.title, 'WIP') &&
32+
!contains(github.event.pull_request.title, 'wip')
2733
runs-on: ubuntu-latest
2834

2935
steps:

.github/workflows/notify-feishu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222
jobs:
2323
notify:
2424
name: "Notify (overall)"
25+
# Don't notify when CI was skipped (draft/WIP/fork-internal PRs)
26+
if: github.event.workflow_run.conclusion != 'skipped'
2527
runs-on: ubuntu-latest
2628
timeout-minutes: 5
2729
continue-on-error: true

0 commit comments

Comments
 (0)