Support re-checking, overriding, and requiring the PR dependency check (#8120)

There are a world of reasons why the dependent state check can be wrong
or get stuck. We need ways to manually override inaccurate findings or
trigger a re-check when things change.

Overriding: removing the `dependent` label causes the job to run and
immediately report success to unblock merging. The `workflow_dispatch`
can also run with an `override` mode. This requires adding more tracked
state in the form of _ignored_ PRs that would otherwise be considered
dependencies.

Re-checking: the job now makes the status have a `Details` link that can
be used to re-run it, and editing the PR description also re-runs it.
However, adding the `dependent` label or doing an explicit
`workflow_dispatch` with mode `recheck` goes further: it drops any
overrides and recomputes the open dependencies from the current commits,
keeping the record of merged dependencies.

Hiding the comment still clears _all_ of the tracked state for the PR,
so the next check starts completely from scratch.

Lastly, this extends the workflow to support being marked as required by
letting it run in the merge queue and report success.

Works to keep the changes to `_process_pr` organized so that we first
collect and analyze the state, and only at the end mutate the PR's state
to the new configuration. Adds relevant unit tests for the new features.
Also added some basic documentation of this so that folks have a
reference when it has issues.

I considered the alternative of parsing mentions out of comments
(dependabot-style), but it ended up significantly more complicated and
brittle, so instead went with basing each change on an operation on the
PR that is already mechanically available.

Assisted-by: Antigravity with Opus
This commit is contained in:
Chandler Carruth authored and GitHub committed 2026-11-13 05:19:44 +00:00
1 parent 92534a0e07
commit b7ea32c3a4
5 files changed
+393 -40

No files matched your search

+33
View File
@@ -15,6 +15,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- [Green tests](#green-tests)
- [Always use pull requests (with review) rather than pushing directly](#always-use-pull-requests-with-review-rather-than-pushing-directly)
- [Small, incremental changes](#small-incremental-changes)
- [Dependent pull requests](#dependent-pull-requests)
- [Linear history](#linear-history)
- [Merging a pull request](#merging-a-pull-request)
@@ -102,6 +103,38 @@ review you typically want to leave the development history undisturbed until the
end so that comments on any particular increment aren't lost. We typically use
the GitHub squash-and-merge functionality to land things.
### Dependent pull requests
When splitting work into a series of changes that build on each other, open each
pull request against `trunk` with the commits from earlier unmerged pull
requests included in its branch.
The `PR dependencies check` status tracks these dependencies based on shared
commits:
- While a pull request depends on other open pull requests, the check adds the
`dependent` label, posts a comment linking to the diff of just that pull
request's commits, and leaves its status `pending` so it doesn't merge
before its dependencies.
- Once those pull requests merge, the check removes the `dependent` label,
updates the comment, and marks the status `success`.
If the check becomes stale, editing the pull request description runs it again.
Contributors with write access can also re-run the workflow job from the check's
`Details` link, or use the `dependent` label:
- **Re-check**: Adding the label drops any override and recomputes the open
dependencies from the current commits. If the label is already present,
remove and re-add it.
- **Override**: Removing the label ignores the currently detected dependencies
and marks the status `success`.
Both are also available by manually running the
[`Check Dependent PRs` workflow](https://github.com/carbon-language/carbon-lang/actions/workflows/check_dependent_pr.yaml)
with the `recheck` or `override` mode. Hiding the check's comment discards all
of its tracked state, including merged dependencies, so the next check starts
from scratch.
## Linear history
We want the history of the `trunk` branch of each repository to be as simple and