From 4267b38f7e54fcc5fc1d037a9d1c3aa8960191a4 Mon Sep 17 00:00:00 2001
From: Philip Offtermatt
Date: Fri, 18 Aug 2023 10:43:29 +0200
Subject: [PATCH] Add backport action
---
.github/workflows/backport.yml | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 .github/workflows/backport.yml
diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml
new file mode 100644
index 0000000..f509196
--- /dev/null
+++ b/.github/workflows/backport.yml
@@ -0,0 +1,30 @@
+name: Backport PRs
+on:
+ pull_request:
+ types:
+ - closed
+
+jobs:
+ backport:
+ runs-on: ubuntu-latest
+ if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'backport')
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Install Hub CLI
+ run: sudo snap install --classic hub
+
+ - name: Backport to v0.34.x
+ run: |
+ git checkout v0.34.x
+ git cherry-pick ${{ github.event.pull_request.merge_commit_sha }}
+ git push
+ hub pull-request -m "Backport: ${{ github.event.pull_request.title }}"
+
+ - name: Backport to v0.37.x
+ run: |
+ git checkout v0.37.x
+ git cherry-pick ${{ github.event.pull_request.merge_commit_sha }}
+ git push
+ hub pull-request -m "Backport: ${{ github.event.pull_request.title }}"