Aakvatech Limited - Automating Frappe Backport Monitoring with GitHub Actions

Backporting fixes between Frappe v15 and v16 branches can leave unresolved cherry-pick conflicts. Learn how Aakvatech is building centralized monitoring, reconciliation, and rollout automation.

 · 11 min read

Automating GitHub Backport Monitoring Across Frappe and ERPNext Apps

How Aakvatech enhanced its centralized GitHub Actions infrastructure to track failed cherry-picks, reconcile missing backports, and distribute standardized workflows across multiple Frappe application repositories.

The challenge: A green CI pipeline does not always mean a completed backport

Maintaining custom Frappe and ERPNext applications across multiple framework versions presents a recurring challenge: ensuring that important changes reach every branch where they are required.

At Aakvatech, our application repositories commonly maintain branches such as:

  • version-15-hotfix
  • version-16-hotfix
  • version-15
  • version-16

A developer might implement a fix in version-16-hotfix, merge the pull request, and add the label:

backport-to-version-15-hotfix

A GitHub Action then attempts to backport the change automatically.

When the destination branch is sufficiently similar to the source, this process can work with little intervention.

However, as branches diverge, automatic cherry-picking becomes more difficult.

A change implemented against Frappe v16 may depend on code structures that differ substantially from Frappe v15. The cherry-pick can encounter conflicts, requiring a developer to manually adapt the change.

The problem is not necessarily the conflict itself. Conflicts are a normal part of maintaining multiple software versions.

The operational risk is that a failed backport may be forgotten after the developer moves on to another task.

A GitHub Actions log may report the failure, but without a persistent exception register, the team has no consolidated way to determine which fixes remain missing from older branches.

We wanted to address this challenge without creating a separate application or introducing another infrastructure dependency.

Our existing centralized repository, Aakvatech-Limited/frappe-maintenance, provided the foundation.


Our solution: Three pull requests, one centralized architecture

We divided the enhancement into three focused pull requests.

Pull request Enhancement Purpose
PR #9 Per-target backport reporting Record what happened during each automatic backport attempt
PR #10 Centralized reconciliation Identify unresolved backports and maintain an exception register
PR #12 Organization-wide caller migration Roll out centralized backport workflows to maintained app branches

Together, these changes establish the foundations of a backport control system with three responsibilities:

Attempt reporting → Completion verification → Organization-wide adoption

The implementation uses GitHub Actions, the GitHub API, Python, reusable workflows, and GitHub Issues.

It does not require an ERPNext DocType, external database, or separate dashboard service.

PR 1: Capture what happened to every requested target branch

Pull request: #9 — Capture per-target backport failures and created PRs

Why we needed this change

Our existing backport action already supported automatic cherry-picking through korthout/backport-action@v4.

It also commented on the original pull request when the GitHub Action failed.

However, reporting at the workflow level was insufficient.

Consider a source PR carrying two labels:

backport-to-version-15-hotfix
backport-to-version-16-hotfix

The backport into v16 might succeed while the v15 backport encounters conflicts.

We needed to capture these as two separate outcomes.

What changed

We enhanced the reusable workflow:

.github/workflows/backport-reusable.yml

The workflow now records the outcome of the backport action using a dedicated step identifier.

- name: Create backport PR(s)
  id: backport_action
  uses: korthout/backport-action@v4
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    label_pattern: "^backport-to-(.+)$"
    merge_commits: "skip"

A subsequent reporting step evaluates the requested target branches and records the available action outputs.

Machine-readable backport reports

Each execution produces a JSON report containing details such as:

{
  "schema_version": 1,
  "repository": "Aakvatech-Limited/example-app",
  "source_pr": 125,
  "action_outcome": "success",
  "targets": [
    {
      "target": "version-15-hotfix",
      "status": "cherry_pick_failed",
      "success": false,
      "backport_prs": []
    },
    {
      "target": "version-16-hotfix",
      "status": "pr_created",
      "success": true,
      "backport_prs": [
        {
          "number": 128,
          "url": "https://github.com/Aakvatech-Limited/example-app/pull/128"
        }
      ]
    }
  ]
}

Illustrative JSON demonstrating the intended reporting structure.

The report is uploaded as a GitHub Actions artifact named backport-results, with a retention period of 90 days.

The workflow also generates a human-readable summary and maintains an exception comment on the original PR when target outcomes fail or cannot be determined.

The important distinction

We intentionally separate three events:

  1. The automatic backport action ran.
  2. The action created a backport PR.
  3. The backport PR was merged into its target branch.

These are not equivalent.

A successfully created PR may remain open for days or fail its CI checks.

Therefore, PR creation must not be treated as proof that the target branch has received the fix.

That distinction became the foundation for our second enhancement.


PR 2: Build an organization-wide backport exception register

Pull request: #10 — Central backport reconciliation and exception register

PR 1 records what happened during an individual attempt. PR 2 addresses a broader operational question:

Which backports are still outstanding today?

To answer this, we introduced a centralized reconciliation workflow that inspects the current state of application repositories.

A scheduled reconciliation process

The new workflow is located at:

.github/workflows/backport-reconciliation.yml

It supports both scheduled and manual execution.

name: Backport Reconciliation

on:
  workflow_dispatch:
    inputs:
      days:
        description: Historical lookback in days (1-730)
        default: '90'
        type: string
      repository:
        description: Optional single repository
        type: string
      dry_run:
        description: Preview without updating Issues
        default: true
        type: boolean

  schedule:
    - cron: '15 5 * * *'

The scheduled execution occurs daily at 05:15 UTC, equivalent to 08:15 in Tanzania.

The manual trigger is particularly useful when investigating specific repositories or historical backport failures.

How reconciliation works

The Python implementation resides in:

scripts/reconcile_backports.py

At a high level, the reconciler:

  1. Discovers eligible repositories in the Aakvatech GitHub organization.
  2. Retrieves merged source pull requests carrying backport-to-* labels.
  3. Identifies the requested destination branches.
  4. Searches for linked backport pull requests targeting those branches.
  5. Determines whether those backport PRs are merged, still open, or not found.
  6. Updates a central GitHub Issues register with the outstanding exceptions.

Each combination of repository, source PR, and target branch is tracked independently.

For example:

PropMS #107 → version-15-hotfix

is a different exception from:

PropMS #107 → version-16-hotfix

This distinction matters because each branch can have different compatibility constraints and integration status.

Backport reconciliation statuses

Status Meaning
completed A linked backport PR has been merged
awaiting_merge A linked backport PR is open
unverified No linked backport PR was identified

Only linked merged backport PRs are automatically treated as completed by this implementation.

An open backport PR remains outstanding.

Where no linked PR is found, the status remains unverified.

Why we deliberately use conservative verification

One of the most important design decisions was avoiding false confirmations.

A developer may manually cherry-pick a fix, resolve conflicts, and commit the resulting changes directly or through another PR.

The original commit SHA may not exist in the destination branch because conflict resolution can produce a different commit.

Similarly, an equivalent change may have been implemented independently.

Simply checking for the original SHA would therefore be unreliable.

Our current reconciler does not perform full patch-equivalence analysis. Instead, it treats missing linked evidence as an unresolved verification case.

Unverified does not necessarily mean failed.

This is a limitation worth documenting clearly, because inaccurate success reporting can be more damaging than incomplete reporting.

GitHub Issues as the persistent exception register

Rather than building a separate database, we use Issues in frappe-maintenance.

An exception Issue contains the original PR reference, target branch, current status, evidence, and any identified backport candidates.

When a linked backport PR is subsequently verified as merged, the reconciliation process can close the corresponding Issue.

This gives the engineering team a persistent, searchable record instead of depending entirely on historical GitHub Actions logs.

Configure authentication

A central workflow needs to inspect pull requests across multiple repositories.

For repositories outside the current workflow repository—particularly private repositories—the default GITHUB_TOKEN is generally insufficient.

We therefore use a dedicated secret:

BACKPORT_MONITOR_TOKEN

Configure it under:

frappe-maintenance → Settings → Secrets and variables → Actions → Repository secrets

A fine-grained token should have the necessary repository metadata and pull-request read permissions for monitored repositories, along with Issues read/write permissions for the central exception register.

The token should never be stored directly in YAML files or committed to Git.

Running the first reconciliation

We recommend beginning with a dry run against a single repository.

From the frappe-maintenance Actions tab, open Backport Reconciliation and select Run workflow.

Use:

repository: av_tools
days:       90
dry_run:    true

Inspect the resulting backport-reconciliation.json artifact and confirm the candidate backports.

Once the results have been reviewed, repeat with:

dry_run: false

This enables the issue-management operations.

A later organization-wide execution can omit the repository filter.

Current implementation boundaries

The historical audit uses a configurable time window and searches for backport PRs linked through the expected title and description conventions.

Older records outside the search window or pagination limits may not be detected.

The current implementation also does not automatically verify arbitrary manual cherry-picks through commit or patch equivalence.

These limitations are important when using the report for release governance.


PR 3: Distribute the centralized workflow across Frappe applications

Pull request: #12 — Targeted rollout of centralized backport callers

Once centralized reporting and reconciliation are available, another challenge remains: ensuring application repositories actually use the shared implementation.

In an organization maintaining many custom ERPNext applications, copying a workflow into every repository creates unnecessary duplication.

A change to the backport logic may otherwise require edits to dozens of independent YAML files.

Reusable workflows and lightweight callers

Our architecture separates the implementation from the trigger.

The central implementation resides in:

frappe-maintenance/.github/workflows/backport-reusable.yml

Application repositories use a lightweight caller:

name: Backport

on:
  pull_request_target:
    types: [closed, labeled]

permissions:
  contents: write
  pull-requests: write

jobs:
  shared:
    uses: Aakvatech-Limited/frappe-maintenance/.github/workflows/backport-reusable.yml@stable

The application retains its event triggers and permissions, while the implementation is centrally maintained.

This allows approved updates to the shared workflow to be adopted without repeatedly copying the full YAML implementation.

Why the stable branch matters

Applications reference:

@stable

rather than automatically consuming every commit merged into the central repository's main branch.

Our maintenance process uses a dedicated publication workflow to advance the stable reference to an approved commit.

This provides an additional review and validation boundary between development changes and their adoption by application repositories.

Importantly, merging a pull request into frappe-maintenance/main does not by itself guarantee that applications referencing @stable will receive those changes.

The new central commit must also be published to stable.

The mass migration campaign

PR 3 introduced:

configs/migrate-backport-callers.json

This configuration works with the existing Mass PR engine:

scripts/mass_pr.py

Its purpose is deliberately narrow: replace standalone .github/workflows/backport.yml implementations with the central caller.

It does not modify unrelated CI workflows.

The campaign supports eligible Frappe applications on their default branches and version branches matching the configured naming pattern, including version-15-hotfix and version-16-hotfix.

Rolling out safely

The recommended sequence is:

  1. Publish the approved reusable backport workflow to stable.
  2. Open Mass PR Across Organization in frappe-maintenance.
  3. Select configs/migrate-backport-callers.json.
  4. Run a dry-run pilot against av_tools.
  5. Review the proposed changes and check GitHub Actions permissions.
  6. Create and review the pilot migration PR.
  7. After confirming the pilot works, expand the campaign to other eligible repositories.

The mass migration engine creates reviewable pull requests rather than silently overwriting production branches.

This distinction is important for application repositories that may contain branch-specific CI customizations.

What PR 3 does not do

PR 3 introduces the targeted migration campaign.

It does not mean that every Frappe application has already migrated, nor does it automatically merge migration PRs.

The operational rollout remains a controlled process.


End-to-end architecture

The three enhancements establish the following flow:

Alt text

The centralized caller migration is the deployment mechanism that enables application repositories to use the shared backport implementation. Reconciliation itself runs centrally.

Business and engineering benefits

The value of this approach extends beyond saving developer time.

Reduced risk of missing fixes: A source PR requesting a backport creates an identifiable expectation that can be checked against the destination branch.

Improved engineering accountability: Unresolved backports can be represented as persistent work items rather than forgotten log entries.

Better release governance: A successful build, a successful backport attempt, and a completed branch integration are treated as distinct events.

Less CI maintenance: Central reusable workflows reduce the number of independent YAML implementations that must be maintained.

Historical visibility: The reconciler can examine previously merged PRs within its configured lookback period, helping identify older outstanding work.

Easier onboarding: Developers can follow standardized labels and workflows instead of learning different backport procedures for each application.

These are expected operational benefits of the architecture. Actual reductions in missed fixes or resolution times should be measured after rollout.


Troubleshooting and practical considerations

The reconciliation workflow reports a missing token

Check that BACKPORT_MONITOR_TOKEN is configured in the frappe-maintenance repository and has access to the intended organization repositories.

Organization approval and token repository selection must also be considered.

A manually cherry-picked change is still shown as unverified

This can be legitimate.

The current reconciliation implementation relies on linked backport PR evidence and does not automatically establish patch equivalence for manually applied commits.

Review the target branch and associated PRs before treating the item as unresolved engineering work.

An application still uses the old backport implementation

Check the application's .github/workflows/backport.yml and confirm that it references the central reusable workflow at @stable.

Also verify that the migration PR has been merged into the relevant source branch.

A new central change is not appearing in application workflows

Confirm that the new implementation has been published to stable, not merely merged to main.

Then inspect the caller's configured reference and the workflow run's resolved implementation.

GitHub Actions status checks change after migration

Migrating to reusable workflows can change the job context visible to branch protection rules.

Validate the required check names in a pilot before rolling out the new caller broadly.


Future improvements

The current implementation is an important starting point, but the following enhancements would make it a stronger backport governance system:

  • Patch-equivalence verification: Detect commits that were manually cherry-picked with different SHAs.
  • Better action-result ingestion: Use the per-target artifacts from PR 1 as additional evidence during reconciliation.
  • Explicit waivers: Allow maintainers to record why a backport is intentionally not required.
  • Aging and escalation: Identify backports outstanding for more than an agreed threshold, such as 24 or 48 hours.
  • Operational metrics: Measure completion rate, average resolution time, conflict frequency, and outstanding backports per target branch.
  • Notifications: Produce consolidated digests for outstanding exceptions rather than depending on individual workflow comments.

These improvements should build on the existing central system rather than introducing another reporting repository or independent set of workflow implementations.

Final recommendation

For teams maintaining Frappe and ERPNext applications across multiple framework versions, backport automation should not stop at attempting a cherry-pick.

It should also answer:

Was the requested change actually integrated into every intended branch?

Our implementation in frappe-maintenance addresses this through three complementary enhancements: per-target reporting, central reconciliation, and reusable workflow distribution.

The most important design principle is that automation success is not the same as change delivery.

A reliable maintenance process needs an auditable record of what was requested, what was attempted, what was verified, and what remains outstanding.

By keeping this logic centralized and integrating it into existing GitHub workflows, Frappe application maintainers can improve version synchronization without substantially increasing their operational infrastructure.

Reference articles and discussions

Aakvatech implementation

Technologies and official documentation

The implementation was developed through Aakvatech's GitHub-based maintenance workflows, with AI assistance in technical analysis, implementation planning, and documentation.


Aakvatech Limited is a Frappe Gold Partner and ERPNext implementation company headquartered in Dar es Salaam, Tanzania, operating across East Africa and the UAE.

This article was co-created using AI to accelerate drafting, with final insights curated and validated by the author. Any customer, personal, or sensitive data referenced during drafting has been anonymized or masked where applicable. All contributors, reference URLs, tools, and materials used to assist this content curation are credited in the Reference section.


No comments yet.

Add a comment
Ctrl+Enter to add comment