Repository navigation
Description
Summary
Add auto-backport.yml to create backport PRs automatically for each checked branch when a PR merges into main, and post-backport-branch.yml to replace the placeholder changelog.yml link with the actual backport PR URL once the PR exists. Together these deliver the full automated backport loop: check a box, merge, get a PR.
Background
With the checklist in place, authors can indicate which branches need a backport. auto-backport.yml closes the loop by reading those checked boxes on merge and calling backport_apply.sh for each. It also supports adding missed branches after merge via issue_comment edits.
post-backport-branch.yml handles a timing issue: the changelog.yml entry is written by backport_apply.sh before the PR URL is known, so the link is initially a placeholder (the original PR link). This workflow fires after the backport PR is opened and replaces it with the correct URL. It mirrors the post-dependabot.yml pattern already used in elastic/elastic-agent.
Deliverables
auto-backport.yml
- Permissions:
contents: write,pull-requests: write
Triggers:
pushtomain— fires after every merged PRissue_commentedited — job-level conditionif: ${{ github.event.issue.pull_request }}ensures this only runs for PR comments, not plain issue comments; further guards: PR must be merged, comment must contain the<!-- backport-checklist -->marker, andbaseRefNamemust bemain, and the editing actor must havewriteoradminpermission on the repository
Behaviour:
- (issue_comment) Verifies the editing actor has
writeoradminpermission viarepos/{owner}/{repo}/collaborators/{actor}/permission; exits silently if not - Recovers the merged PR via
gh pr list --search <sha> - Skips PRs with the
backport:sync-changeloglabel (prevents re-triggering on changelog-sync PRs) - Finds and parses the
<!-- backport-checklist -->comment; exits silently if not found - Deduplication:
gh pr list --head auto-backport/<pkg>-<major.minor>-<sha> --state all— skips branches already processed (handles re-runs,issue_commentre-triggers, and deliberately closed backport attempts) - For each checked branch: calls
backport_apply.sh --sha <merge-sha> --package <pkg> --target <branch> --open-pr --json - On success: updates checklist line →
- [x] \backport-aws-6.14` — ✅ #XXXX` - On conflict: updates checklist line →
- [x] \backport-aws-6.14` —⚠️ conflict: @ please run manually: ...`
post-backport-branch.yml
- Permissions:
contents: write
Trigger: pull_request opened → backport-*, condition startsWith(head_ref, 'auto-backport/')
Flow:
- Checks out the PR branch
- Identifies the package from the branch name (
auto-backport/<package>-<major.minor>-<sha>) - Replaces the placeholder link in
changelog.ymlwithgithub.event.pull_request.html_urlviayq - Commits and pushes
Only triggers on opened (not synchronize) so the follow-on commit does not re-trigger the workflow.
Considerations
-
Nested package directories:
post-backport-branch.ymlidentifies the package from the branch name (auto-backport/<package>-<major.minor>-<sha>) and then locateschangelog.ymlto update the link. The path resolution must support bothpackages/<package>andpackages/<technology>/<package>. Investigate whethermage listPackagesor an equivalent helper provides a name → path mapping. -
No
pull_request_target:auto-backport.ymlusespushtomain(notpull_request_targetclosed) intentionally, to avoid the security risks associated withpull_request_target. Do not change this trigger. -
issue_commentactor permission: theissue_comment editedtrigger runs withcontents: write+pull-requests: writeon a public repository. Without a permission check, any GitHub user can post a comment containing<!-- backport-checklist -->with fabricated checked entries, edit it, and triggerbackport_apply.shwith arbitrary--package/--targetvalues. The actor permission check (first step of the job) closes this. A job-levelifongithub.event.comment.user.loginis not sufficient here because GitHub records checkbox toggles as edits by the toggler, not the original comment author. -
Upstream repository only: this workflow assumes the backport branch (
auto-backport/<package>-<major.minor>-<sha>) is created and pushed directly to theelastic/integrationsupstream repository, not to a fork.auto-backport.ymlruns onpushtomain(base repository context) withcontents: writepermissions, so it can push branches to the upstream repo. Contributors working from forks will need to trigger backports manually viabackport_apply.shon their own fork or request a team member to run the automation.
Acceptance criteria
- Restore the message in the checklist comment to mention that Pull Requests will be created for the selected branches: backport: automate backport PR creation from checklist and fix changelog links #19214 (comment)
- Restore the checkboxes in the checklist comment to select messages: backport: automate backport PR creation from checklist and fix changelog links #19214 (comment)
- Checking boxes in the checklist before merge and merging creates backport PRs for each checked branch
- A conflict on one branch does not block the other branches
- Checking boxes after merge (via checklist edit) creates PRs for the newly checked branches without duplicating already-processed ones
- The
changelog.ymllink in each backport PR points to the backport PR itself, not the original PR - PRs labelled
backport:sync-changelogare silently skipped
EDITED:
- Updated the label to skip Pull Requests to be
backport:sync-changeloginstead ofautomation.
Activity
infra-vault-gh-plugin-prod commentedon May 26, 2026
Pinging @elastic/ecosystem (Team:Ecosystem)
github-actions commentedon May 26, 2026
tl;dr: #19214 is the right next orchestration issue, but it should be implemented on top of the foundation issues (
#19210,#19212,#19213) and by reusing existing idempotency/guard patterns already present in repo workflows.Recommendation
Implement
auto-backport.yml+post-backport-branch.ymlas proposed in this issue, sequenced after the inventory/apply/checklist foundations.Concretely:
pushtomain+issue_commenteditedtriggers forauto-backport.yml(as specified here, and avoidingpull_request_target).main, presence of<!-- backport-checklist -->, and not labeledautomation.post-backport-branch.ymlas a narrowpull_request: openedhandler forbackport-*+startsWith(head_ref, 'auto-backport/')to patch the placeholder changelog link once the PR URL exists.Findings
.buildkite/pipeline.backport.yml:13-19(if: build.source != 'ui'guard).buildkite/pipeline.backport.yml:20-50(manual input fields)docs/ci_pipelines.md:225-227(explicitly documented as UI-triggered only).github/workflowshas no backport/changelog automation workflow names)..github/workflows/trigger-mention-in-pr.yml:3-4,20-21.github/workflows/docs-preview-cleanup.yml:3-4.github/workflows/notify-package-docs-failure.yml:40-50.github/workflows/trigger-pr-actions-detective.yml:40.mergify.yml:9-14backport-checklistsearch returned no hits), which aligns with this being staged work tied to#19213.packages/cisco_meraki/changelog.yml:11→link: TBDpackages/tenable_io/changelog.yml:124→/pull/999999#19210defines.backports.yml+ active-branch check as foundation#19212definesbackport_apply.sh(the per-branch execution primitive)#19213defines checklist posting/update mechanism#19214then consumes that checklist to drive PR creation + link fixVerification
I ran repository commands to verify current state and concrete gaps:
Detailed Action Plan
Add
.github/workflows/auto-backport.yml:pushtomainandissue_commentedited.push: recover merged PR by SHA and hard-gate to basemain.issue_comment: requiregithub.event.issue.pull_request != null, merged PR, basemain, and comment containing<!-- backport-checklist -->.automationlabel (same intent as existing label-gate workflows).auto-backport/<pkg>-<target>-<sha>PRs/heads.dev/scripts/backport_apply.sh --jsononce per checked branch; on each result update the checklist line with either ✅ PR orAdd
.github/workflows/post-backport-branch.yml:pull_requestopenedfor basebackport-*, plusstartsWith(github.head_ref, 'auto-backport/').auto-backport/<package>-<series>-<sha>.changelog.ymllink to${{ github.event.pull_request.html_url }}.synchronizeto avoid loops.Reuse existing safety/idempotency patterns directly from current workflows:
notify-package-docs-failure.yml:40-50.trigger-pr-actions-detective.yml:40.Wire ordering with foundation issues:
#19210,#19212,#19213as prerequisites; backport: automate backport PR creation from checklist and fix changelog links #19214 should consume their outputs (.backports.yml,backport_apply.sh, checklist comment format) rather than redefining them.Update docs once workflows merge:
docs/extend/developer-workflow-support-old-package.md:117-121to describe automated changelog-link/PR flow and manual fallback path.Related Items
backport_apply.shexecution primitive.buildkite/pipeline.backport.yml:13-19,20-50docs/ci_pipelines.md:225-227.github/workflows/notify-package-docs-failure.yml:40-50Note
🔒 Integrity filter blocked 8 items
The following items were blocked because they don't meet the GitHub integrity level.
search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter:What is this? | From workflow: Issue Triage
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
mrodm commentedon Jun 1, 2026
Updated the description to capture a security requirement for the issue_comment trigger: the editing actor must be verified as a repo collaborator with
writeoradminpermission before the job proceeds. Without this, any GitHub user on a public repo can craft a comment that passes all the existing guards and trigger backport_apply.sh with arbitrary inputs. Added the guard to the Triggers spec, Behaviour steps, and Considerations.mrodm commentedon Jul 2, 2026
In the description of this issue, it is mentioned to use the
automationlabel.In this PR #19930 , it is being proposed to change the
automationlabel tobackport:sync-changelog. Thereby, this process uses a specific label that is not used by other automation processes.mrodm commentedon Jul 6, 2026
It would be needed to update the message posted in the checklist comment to mention that with these changes are going to be created Pull Requests targeting the backport branches selected.
Maybe something like this could feat:
Related https://github.com/elastic/integrations/pull/19997/changes#r3530418845
render branches as plain list until auto-backport PR creation lands (e…
mrodm commentedon Jul 8, 2026
It will be needed to recover the checkboxes in the checklist comment.
For context #19997 (comment)