From 86ad3ae57e6c467e8fc9966324380fd136fb71f3 Mon Sep 17 00:00:00 2001 From: Manos Vlassis <57320708+mvlassis@users.noreply.github.com> Date: Tue, 31 Mar 2026 11:42:33 +0200 Subject: [PATCH] feat: add automated backport support (#171) * feat: add automated backport support with latest track * chore: sync PR workflow comments with admission-webhook-operator (cherry picked from commit 431c378b75f5d9a03d20c8ef5a13d300cf419b2a) --- .github/automatic_backport_tracks.yaml | 2 ++ .github/workflows/on_pull_request.yaml | 10 ++++++++ .github/workflows/on_pull_request_closed.yaml | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .github/automatic_backport_tracks.yaml create mode 100644 .github/workflows/on_pull_request_closed.yaml diff --git a/.github/automatic_backport_tracks.yaml b/.github/automatic_backport_tracks.yaml new file mode 100644 index 0000000..b2c35e3 --- /dev/null +++ b/.github/automatic_backport_tracks.yaml @@ -0,0 +1,2 @@ +automatic_backport_tracks: + - track/ckf-1.10 diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml index 3d7eef1..d5477af 100644 --- a/.github/workflows/on_pull_request.yaml +++ b/.github/workflows/on_pull_request.yaml @@ -1,6 +1,7 @@ name: On Pull Request # On pull_request, we: +# * create backport labels if it is against main, only when the PR is opened/reopened # * always publish to charmhub at latest/edge/branchname # * always run tests @@ -9,6 +10,15 @@ on: jobs: + populate-labels: + name: Populate labels + if: github.base_ref == 'main' && (github.event.action == 'opened' || github.event.action == 'reopened') + uses: canonical/charmed-kubeflow-workflows/.github/workflows/populate-labels.yaml@main + secrets: inherit + with: + track_file_path: ".github/automatic_backport_tracks.yaml" + label_prefix: "backport " + tests: name: Run Tests uses: ./.github/workflows/integrate.yaml diff --git a/.github/workflows/on_pull_request_closed.yaml b/.github/workflows/on_pull_request_closed.yaml new file mode 100644 index 0000000..bf4c1de --- /dev/null +++ b/.github/workflows/on_pull_request_closed.yaml @@ -0,0 +1,23 @@ +name: On Pull Request Closed + +# When a pull request is pushed on the main branch, automatically +# create backport PRs according to the labels on the pull request. +# If there are conflicts, create a PR but leave it as draft. + +on: + pull_request_target: + types: [closed] + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + + backport: + name: Backport pull request + if: github.event.pull_request.merged + uses: canonical/charmed-kubeflow-workflows/.github/workflows/backport-pr.yaml@main + secrets: inherit