Skip to content

[ML] Auto-approve automated version-bump PRs - #3137

Merged
edsavage merged 2 commits into
elastic:mainfrom
edsavage:feature/auto-approve-version-bump-prs
Aug 5, 2026
Merged

[ML] Auto-approve automated version-bump PRs#3137
edsavage merged 2 commits into
elastic:mainfrom
edsavage:feature/auto-approve-version-bump-prs

Conversation

@edsavage

@edsavage edsavage commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The automated version-bump PRs (dev-tools/bump_version.sh, e.g. #3135) already arm auto-merge, but stalled on the single required approving review — a human still had to click Approve. This adds a workflow that supplies that approval automatically.

github-actions[bot] (this workflow's GITHUB_TOKEN) approves the PR. Because the PR was authored by elastic-vault-github-plugin-prod[bot], github-actions[bot] is a distinct identity and its approval counts — GitHub forbids self-approval. This is the same mechanism the Backport workflow already uses, and the repo has "Allow GitHub Actions to approve pull requests" enabled. The armed auto-merge then lands the PR once required CI (buildkite/ml-cpp-pr-builds) is green — CI still gates the merge.

Guards / safety

  • Fires only when both: author is elastic-vault-github-plugin-prod[bot] and head branch matches ci/ml-cpp-version-bump-* (the topic branch from bump_version.sh).
  • Diff safety belt: approves only if the PR's sole changed file is gradle.properties; anything broader is skipped and left for a human.
  • Idempotent: skips if github-actions[bot] already approved (reopened PRs re-trigger).
  • Read-only contents, pull-requests: write; does not check out or run PR code (safe under pull_request_target).

Backport note

pull_request_target reads the workflow from the PR's base branch, and bump PRs target release branches — so this file must also live on each active release branch (9.5, 9.4, 8.19). Version labels will be added to backport it there. Until then, release-branch bump PRs still need a manual approval.

Test plan

  • YAML parses; embedded bash bash -n clean
  • On next automated bump PR into main (minor freeze) or a backported branch: github-actions[bot] approves automatically and auto-merge lands it on green CI
  • A hand-crafted PR on a ci/ml-cpp-version-bump-* branch touching a file other than gradle.properties is not auto-approved

Made with Cursor

The automated version-bump PRs already arm auto-merge but stalled on the
single required review. Add a workflow that approves them as
github-actions[bot] (a distinct identity from the vault-app author, mirroring
the Backport workflow), gated to the bump topic branch + author and to a diff
that only touches gradle.properties. Auto-merge then lands them on green CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@elasticsearchmachine

Copy link
Copy Markdown

Pinging @elastic/ml-core (Team:ML)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a GitHub Actions workflow to automatically approve automated version-bump pull requests so that already-armed auto-merge can complete once required CI is green. This targets only the version-bump automation path and uses pull_request_target with minimal permissions to avoid executing PR code.

Changes:

  • Introduces .github/workflows/auto-approve-version-bump.yml to auto-approve version-bump PRs authored by elastic-vault-github-plugin-prod[bot].
  • Guards approval by requiring the head branch prefix ci/ml-cpp-version-bump- and restricting the diff to only gradle.properties.
  • Avoids stacking duplicate approvals by checking for an existing github-actions[bot] approval before approving.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/auto-approve-version-bump.yml Outdated
Query the PR reviews endpoint with --paginate --slurp so the "already approved
by github-actions[bot]" check counts across all pages, not just the first 30.

Co-authored-by: Cursor <cursoragent@cursor.com>
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.4
9.5

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

edsavage added a commit that referenced this pull request Aug 5, 2026
The automated version-bump PRs already arm auto-merge but stalled on the
single required review. Add a workflow that approves them as
github-actions[bot] (a distinct identity from the vault-app author, mirroring
the Backport workflow), gated to the bump topic branch + author and to a diff
that only touches gradle.properties. Auto-merge then lands them on green CI.

---------


(cherry picked from commit 68fb7cc)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage added a commit that referenced this pull request Aug 5, 2026
The automated version-bump PRs already arm auto-merge but stalled on the
single required review. Add a workflow that approves them as
github-actions[bot] (a distinct identity from the vault-app author, mirroring
the Backport workflow), gated to the bump topic branch + author and to a diff
that only touches gradle.properties. Auto-merge then lands them on green CI.

---------


(cherry picked from commit 68fb7cc)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage added a commit that referenced this pull request Aug 5, 2026
The automated version-bump PRs already arm auto-merge but stalled on the
single required review. Add a workflow that approves them as
github-actions[bot] (a distinct identity from the vault-app author, mirroring
the Backport workflow), gated to the bump topic branch + author and to a diff
that only touches gradle.properties. Auto-merge then lands them on green CI.

---------


(cherry picked from commit 68fb7cc)

Co-authored-by: Ed Savage <ed.savage@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants