This document lists down useful workflows that can be added to repositories to alleviate manual processes.
Backporting a PR/commit to a release branch is a manual process and can lead to missed backports before a release. The auto backport Github Action allows to create automatic backport PRs just by labelling them.
When the auto backport workflow is integrated with a repo, the following features are available:
- Allows auto backports on PRs that are merged and labelled (can be in any order). To backport a PR to 1.x, please add a label called
backport 1.x
to the PR and the backport workflow will do the rest. - The backport workflow is now created by a Github App called
opensearch-trigger-bot
instead ofgithub-actions
which allows CI to run on such PRs. - The backport branches are named in the form
backport/backport-<original PR number>-to-<base>
. These branches will be cleaned up by an auto delete workflow once the backport PR is merged.
Integrating the backport workflow is easy and can be done with the following steps:
- Add the backport workflow in your repo.
- Add secrets in your repo for the Github App ID and Private key. This is used to generate a token for the Github App
opensearch-trigger-bot
. Using this token helps generate the automatic backport PR from the app token so that all the CI triggers work on the PR. (OpenSearch#2071) - Add auto delete workflow for deleting the backport branches once the backport PRs are merged. This enables the backport workflow to clean up after itself.
- Backport this auto delete workflow to release branches so the backport branches created against the release branches can be auto deleted.
- Add appropriate branch permissions for backport related branches in your repo.
- Add related labels for release branches. For auto-backports, the labels should be of the form
backport <release-branch-name>
. (backport 1.x
,backport 1.2
etc.)
To use the auto backport workflow:
- Label the original PR according to the release-branch. For example, to backport to 1.x, please add a label
backport 1.x
. You can add multiple backport labels to different release branches. Labels can be added in any order: meaning before or after the PR is merged. Note that there is an auto-labeling action that can be configured to help automate this process. - Once the label is added and the original PR is in a merged state, the auto backport workflow will create backport PR if there are no merge conflicts using
opensearch-trigger-bot
. If there are merge conflicts, it will comment on the original PR on the steps to take. - Once the backport PR is merged, the branch created for backport will be auto-deleted.
An example of auto backport:
- Original PR: opensearch-project/opensearch-java#148 with label
backport 1.x
. - Backport PR: opensearch-project/opensearch-java#151 with merged backport branch auto deleted.