Skip to content

Run docs review and issue scope automatically - #449

Open
theletterf wants to merge 5 commits into
mainfrom
feat/auto-review-and-scope
Open

theletterf wants to merge 5 commits into
mainfrom
feat/auto-review-and-scope

Conversation

@theletterf

Copy link
Copy Markdown
Contributor

Docs review and issue scope both started only from a menu checkbox or a slash command. We want them to run on every new pull request and every new issue.

Both reusable workflows now use roles: all. Before, the activation role check (admin, maintainer, write) would skip a new issue from an outside author and a bot-authored pull request. The callers now decide who can start a run:

  • Pull requests: the caller runs the review when a non-draft pull request from the same repository opens, reopens, or leaves draft. It skips drafts and fork pull requests, because a pull_request run from a fork gets no secrets or id-token. Converting to draft cancels a review in progress through caller-level concurrency.
  • Issues: the caller runs scope on issues: opened.
  • Slash commands (/docs-review, /scope) stay, limited to owners, members, and collaborators by the comment's author_association.

The scope comment footer read "Scope requested by @". For an automatic run, that would name and notify the issue author, which the scope prompt forbids. For an issues event it now reads "Scoped automatically when the issue opened."

I updated both example.yml files and READMEs. Caller PRs for docs-content and docs-content-internal follow. They must merge after a release moves v1, because the callers pin @v1 and only the new locks accept every actor.

Still to do: sandbox tests on this branch (draft, ready for review, convert to draft, new issue, fork-free path). Results go in a comment.

Related to elastic/docs-eng-team#757
Related to elastic/docs-eng-team#759

🤖 Generated with Claude Code

theletterf and others added 2 commits November 9, 2026 10:26
Open both reusable workflows to every actor (roles: all) so callers can run them on
new pull requests and new issues, including bot and external authors. Callers now
own who can start a run: they skip drafts and fork pull requests, and they limit the
slash commands to owners, members, and collaborators.

The scope footer says "Scoped automatically" for an issues event instead of
naming the issue author as the requester.

Related to elastic/docs-eng-team#757
Related to elastic/docs-eng-team#759

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The reusable workflow's conclusion and safe_outputs jobs need it. Without it the
caller run fails at startup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@theletterf

Copy link
Copy Markdown
Contributor Author

Sandbox results (callers pinned to this branch in elastic/docs-actions-sandbox):

  • Non-draft PR opened (sandbox#282): review ran automatically. All jobs succeeded and the bot posted a review with 3 inline comments.
  • Draft PR opened (sandbox#283): the run was skipped.
  • Draft marked ready, then converted back to draft: the in-progress review was cancelled, and the converted_to_draft run was skipped.
  • Issue opened (sandbox#280): scope ran automatically and posted a 🟢 comment. The footer reads "Scoped automatically when the issue opened."

Found on the way: the example caller lacked issues: write, which the review lock needs. Without it the run fails at startup. Fixed in the example. Also, a pull_request run reads the caller file from the PR merge commit, so a caller change needs a fresh PR to test.

Not tested: /docs-review and /scope from a non-member (the author association guard), and a bot-authored PR.

Caller PRs, draft, to merge after the release moves v1: elastic/docs-content#9281 and elastic/docs-content-internal#2169.

@theletterf
theletterf marked this pull request as ready for review November 10, 2026 15:07
@theletterf
theletterf requested a review from a team as a code owner November 10, 2026 15:07
@theletterf
theletterf requested a review from reakaleek November 10, 2026 15:07
Comment thread .github/workflows/gh-aw-docs-review.md Resolved
Comment thread agentic-workflows/docs-review/README.md Resolved
…reviews

Libra review of #449:

- P1: roles: all removed the only actor check for callers that pin @v1 and use an old
  template. Both workflows now gate in an `if:` expression on the activation job. A comment
  starts a run only from an owner, member, or collaborator, or when it edits the menu
  comment. A pull request must come from the same repository. Issues run when they open.
- P2: the example caller's concurrency group is now per pull request only for pull request
  events. A comment gets its own group, so a discussion comment cannot cancel a review.
- P3: the docs-review README example now matches example.yml.

Related to elastic/docs-eng-team#757
Related to elastic/docs-eng-team#759

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/gh-aw-docs-review.md Resolved
Comment thread .github/workflows/gh-aw-docs-review.md Resolved
Libra review of #449, round 2:

- P1: `github.event.action == 'edited'` let through anyone who edited their own comment.
  The edit branch now also requires that the edited comment belongs to a bot. Only a user
  with write access can edit the bot's comment.
- P3: scripts/test_activation_gates.py reads the `if:` of each compiled lock file and
  evaluates it against an event matrix: trusted and untrusted comment authors, menu edits,
  same-repository and fork pull requests, new issues, dispatches. A new workflow runs it.
- P3: authorized /docs-review commands stay in the pull request concurrency group, so
  converting a pull request to draft cancels a review that a command started. Any other
  comment keeps its own group.

Related to elastic/docs-eng-team#757
Related to elastic/docs-eng-team#759

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Libra review of #449, round 3: a fork pull request event joined the shared group and
cancelled a member's /docs-review run, then the job skipped. Only same-repository pull
request events join the group now.

Related to elastic/docs-eng-team#757
Related to elastic/docs-eng-team#759

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@theletterf

Copy link
Copy Markdown
Contributor Author

+CC @florent-leborgne

@theletterf

Copy link
Copy Markdown
Contributor Author

This is blocked and pending on docs managers' decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant