Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
Add GH workflows for cherry-picking PRs to release branches (#1217)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmacik committed Oct 12, 2022
1 parent d0caa6b commit 6cdb804
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/pr-cherry-pick-clean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Clean cherry pick PR branch"

on:
pull_request_target:
branches:
- 'release-v**.x'
types: [closed]

jobs:
delete-cherry-pick-branch:
runs-on: ubuntu-latest
steps:
- name: delete-cherry-pick-branch
uses: actions/github-script@v6
env:
REPO: ${{ secrets.SBO_CHERRY_PICK_REPO }}
with:
github-token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
script: |
const [owner, repo] = process.env.REPO.split('/');
const ref = `heads/${context.payload.pull_request.head.ref}`;
const deleteParams = { owner, repo, ref };
console.log(`Deleting branch: "${ref}"`);
try {
github.rest.git.deleteRef(deleteParams);
} catch(e) {
console.log("Cannot delete branch; error:", e);
}
84 changes: 84 additions & 0 deletions .github/workflows/pr-cherry-picks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Cherry pick PR to release branches"

on:
pull_request_target:
branches:
- master
types: [closed]

jobs:
cherry_pick_release_v1_1_x:
runs-on: ubuntu-latest
name: Cherry pick into release-v1.1.x branch
if: contains(github.event.pull_request.labels.*.name, 'release/v1.1.x') && github.event.pull_request.merged
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup SSH for cherry-pick repo
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }}
- name: Cherry pick into release-v1.1.x
uses: pmacik/github-cherry-pick-action@main
with:
cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }}
token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
branch: release-v1.1.x
exclude-labels: |
release/v1.2.x
release/v1.3.x
labels: |
cherry-pick
title-prefix: "cherry-pick(release-v1.1.x): "
cherry_pick_release_v1_2_x:
runs-on: ubuntu-latest
name: Cherry pick into release-v1.2.x branch
if: contains(github.event.pull_request.labels.*.name, 'release/v1.2.x') && github.event.pull_request.merged
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup SSH for cherry-pick repo
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }}
- name: Cherry pick into release-v1.2.x
uses: pmacik/github-cherry-pick-action@main
with:
cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }}
token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
branch: release-v1.2.x
exclude-labels: |
release/v1.1.x
release/v1.3.x
labels: |
cherry-pick
title-prefix: "cherry-pick(release-v1.2.x): "
cherry_pick_release_v1_3_x:
runs-on: ubuntu-latest
name: Cherry pick into release-v1.3.x branch
if: contains(github.event.pull_request.labels.*.name, 'release/v1.3.x') && github.event.pull_request.merged
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup SSH for cherry-pick repo
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }}
- name: Cherry pick into release-v1.2.x
uses: pmacik/github-cherry-pick-action@main
with:
cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }}
token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }}
branch: release-v1.3.x
exclude-labels: |
release/v1.1.x
release/v1.2.x
labels: |
cherry-pick
title-prefix: "cherry-pick(release-v1.3.x): "

0 comments on commit 6cdb804

Please sign in to comment.