浏览代码

CI: Re-run lint when a PR's base branch changes (#676)

Add 'edited' to the lint workflow's pull_request trigger, guarded so the
SwiftFormat job only re-runs when the base branch actually changed.

Retargeting a PR (e.g. main -> dev) fires pull_request: edited, which the
default trigger types (opened, synchronize, reopened) ignore. When the new
base requires the SwiftFormat status check, GitHub leaves it 'Expected -
waiting for status to be reported' with no run behind it, blocking the PR
indefinitely. Re-running on base change ensures the required check actually
reports against the new base.
Jonas Björkert 1 月之前
父节点
当前提交
86fd0059d7
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      .github/workflows/lint.yml

+ 7 - 0
.github/workflows/lint.yml

@@ -3,6 +3,10 @@ run-name: Lint (${{ github.head_ref || github.ref_name }})
 
 
 on:
 on:
   pull_request:
   pull_request:
+    # 'edited' so the lint re-runs when a PR's base branch is changed; otherwise
+    # retargeting (e.g. main -> dev) leaves the required SwiftFormat check with no
+    # run on the new base and the PR stays blocked indefinitely.
+    types: [opened, synchronize, reopened, edited]
   workflow_dispatch:
   workflow_dispatch:
 
 
 concurrency:
 concurrency:
@@ -15,6 +19,9 @@ permissions:
 jobs:
 jobs:
   swiftformat:
   swiftformat:
     name: SwiftFormat
     name: SwiftFormat
+    # Run on open/sync/reopen always; on 'edited' only when the base branch
+    # actually changed, so routine title/description edits don't re-lint.
+    if: ${{ github.event.action != 'edited' || github.event.changes.base != null }}
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     container: swift:6.0
     container: swift:6.0
     steps:
     steps: