Repository navigation
Conversation
The `main` ruleset requires a code-owner review, and a GitHub App such as Libra cannot be a code owner. Every PR therefore waits for a human approval, even after Libra approves. A new required `team-review` status replaces that rule. It passes when a docs-engineering member or `dependabot[bot]` opened the PR. Otherwise it passes only when a docs-engineering member approved the current head commit. `team-review-trigger.yml` hands review events to `team-review.yml`, because a fork review gets no secrets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| concurrency: | ||
| group: team-review-${{ github.event.pull_request.number || github.event.workflow_run.id }} | ||
| cancel-in-progress: false |
There was a problem hiding this comment.
Severity: P2 (Medium)
The concurrency group does not serialize evaluations of the same PR. Runs triggered by workflow_run are keyed by workflow_run.id, so a review-triggered run and a pull_request_target run for the same PR (or two review runs) can run at the same time. Each one reads the reviews and then POSTs the status on its own schedule. A slower run that saw an approval can post success after a newer run already posted failure for a dismissal or a changes-requested review. The head commit then keeps a stale green team-review, and once the status is required that can let a PR merge without a valid approval. Consider re-reading the reviews right before posting, or passing a per-PR key into a separate concurrency-limited job after the PR number is resolved.
Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.
| # Latest review per reviewer, on the current head commit, that approves. | ||
| approvers=$(gh api --paginate "repos/$REPO/pulls/$pr_number/reviews" \ | ||
| --jq '.[] | select(.state != "COMMENTED") | [.user.login, .state, .commit_id] | @tsv' \ | ||
| | awk -F'\t' -v sha="$head_sha" '{ latest[$1] = ($2 == "APPROVED" && $3 == sha) } END { for (u in latest) if (latest[u]) print u }') | ||
| for user in $approvers; do | ||
| if is_member "$user"; then |
There was a problem hiding this comment.
Severity: P3 (Low)
The new merge decision has no automated coverage for review ordering and head changes. Add cases showing that a later comment preserves an approval, while a dismissal or a new head invalidates it, so edits to the filter can't silently weaken the gate.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
| gh api -X POST "repos/$REPO/statuses/$head_sha" \ | ||
| -f state="$state" -f context=team-review -f description="$description" |
There was a problem hiding this comment.
Severity: P2 (Medium)
team-review evaluates a PR but publishes its verdict on a commit shared by any PR with that head SHA. Once the status is required, GitHub can count a success from one PR toward another PR that has no team approval of its own. Enforce the policy with a check bound to the individual PR, not a shared head status.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
A PR from a docs-engineering member can merge on Libra's approval alone, and a PR from anyone else still needs a docs-engineering approval. This adds the
team-reviewstatus that makes that rule checkable. A later ruleset change makes it required.Affects: Automation
Prompt summary: Require reviews only from contributors outside
@elastic/docs-engineering, because Libra already reviews the team's own PRs. Outside contributors still need a docs-engineering review. Auto-merge has to work for the team's PRs.Why
The
mainruleset requires a code-owner review, and.github/CODEOWNERSnames@elastic/docs-engineering. A GitHub App such as Libra cannot be a code owner, so its approval never satisfies that rule. Every recent PR, such as #5043, also needed a human approval. A bypass actor does not help, because auto-merge never applies a bypass.What
A
team-reviewstatus on every PRThe status passes when a docs-engineering member or
dependabot[bot]opened the PR. Otherwise it passes only when a docs-engineering member approved the current head commit. A push moves the head commit, so an approval from before the push no longer counts.Review events reach the status through a second workflow
A
pull_request_reviewrun from a fork gets no secrets, so it cannot read team membership.team-review-trigger.ymlonly uploads the PR number.team-review.ymlthen runs from the base branch throughworkflow_run, validates the number, and sets the status. Neither workflow checks out PR code.Team membership comes from one API call
The workflow lists
@elastic/docs-engineeringonce and matches the author and the approvers against that list. It mints a token from the existingOBS_AUTOMATION_APP_IDapp withmembers: read.zizmor.ymllists the new workflowteam-review.ymljoins the intentionalpull_request_targetandworkflow_runworkflows, and the comment above the list says why.Risk: The workflow only posts a status. Nothing requires it yet, so it cannot block a merge. If
OBS_AUTOMATIONlacks the orgmembers: readpermission, the token step fails and the run shows red until an org admin adds it. I could not read that app's permissions.Out of scope: The ruleset change. After this merges and
team-reviewhas run green onmain, themainruleset (id 3274800) dropsrequire_code_owner_reviewand requiresteam-review. Updatecli PRs come from an app, notdependabot[bot], so they would fail the check until their author is added to the trusted list. Whether Libra's approval counts toward the one required approval is not yet proven.