-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto CherryPick commits to previous branches
- Loading branch information
1 parent
0fb6966
commit 965e65b
Showing
2 changed files
with
60 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,43 @@ | ||
# CI stages to execute against all branches on PR merge | ||
name: auto_cherry_pick_commits | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
branch-matrix: | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') | ||
name: Generate a branch matrix to apply cherrypicks | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branches: ${{ steps.set-matrix.outputs.branches }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- id: set-matrix | ||
run: echo "::set-output name=branches::$(git branch -rl --sort=-authordate 'origin/6.*.z' --format='%(refname:lstrip=-1)' | head -n2 | jq -cnR '[inputs | select(length>0)]')" | ||
auto_cherry_picking: | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') | ||
name: Auto Cherry picking | ||
needs: branch-matrix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
to_branch: ${{ fromJson(needs.branch-matrix.outputs.branches) }} | ||
steps: | ||
- name: Checkout Nailgun | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
if: matrix.to_branch != github.base_ref | ||
- name: Cherry pick into ${{ matrix.to_branch }} | ||
uses: carloscastrojumo/[email protected] | ||
with: | ||
branch: ${{ matrix.to_branch }} | ||
labels: | | ||
Auto_Cherry_Picked | ||
# skipping PRs remote target_branch from cherrypicking into itself | ||
if: matrix.to_branch != github.base_ref |
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,17 @@ | ||
# CI jobs to check specific labels present / absent | ||
name: required_labels | ||
|
||
on: | ||
pull_request: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
|
||
jobs: | ||
cherrypick_label: | ||
name: Enforcing cherrypick labels | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: mheap/github-action-required-labels@v2 | ||
with: | ||
mode: exactly | ||
count: 1 | ||
labels: "CherryPick, No-CherryPick" |