This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GH workflows for cherry-picking PRs to release branches
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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 | ||
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 | ||
labels: | | ||
cherry-pick | ||
title-prefix: "cherry-pick(release-v1.2.x): " |