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