Skip to content

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

Merged
marionbarker merged 1 commit into
devfrom
ci/lint-rerun-on-base-change
Jun 17, 2026
Merged

CI: Re-run lint when a PR's base branch changes#676
marionbarker merged 1 commit into
devfrom
ci/lint-rerun-on-base-change

Conversation

@bjorkert

Copy link
Copy Markdown
Member

What

Add edited to the lint workflow's pull_request trigger, guarded so the SwiftFormat job only re-runs when the PR's base branch actually changed (not on routine title/description edits).

on:
  pull_request:
    types: [opened, synchronize, reopened, edited]

jobs:
  swiftformat:
    if: ${{ github.event.action != 'edited' || github.event.changes.base != null }}

Why

A real PR got stuck "pending" indefinitely (#653) and this is the fix.

The default pull_request trigger types are [opened, synchronize, reopened]. Changing a PR's base branch fires pull_request: edited — which none of those cover — so the lint workflow does not re-run on a retarget.

That matters because SwiftFormat is a required status check on dev. The failure sequence:

  1. A PR is opened against main (common for new/outside contributors).
  2. It gets retargeted maindev. This fires only edited, so lint does not re-run.
  3. The dev ruleset now requires SwiftFormat, but no run ever reported it on the new base. GitHub shows it as "Expected — waiting for status to be reported" and the PR stays BLOCKED forever, with no run to even approve.

Re-running lint on a base change ensures the required check actually reports against the new base. The if guard keeps it from re-linting on every title/body edit (which also fire edited).

Note: this does not change the fork-PR approval gate — runs on outside-contributor forks still need a maintainer to approve them — but it guarantees there is a run to approve after a retarget, instead of a phantom required check.

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.

@marionbarker marionbarker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve from code review

@marionbarker marionbarker merged commit 86fd005 into dev Jun 17, 2026
1 check passed
@marionbarker marionbarker deleted the ci/lint-rerun-on-base-change branch June 17, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants