-
Notifications
You must be signed in to change notification settings - Fork 115
42 lines (38 loc) · 1.36 KB
/
auto_cherry_pick.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# CI stages to execute against all branches on PR merge
name: auto_cherry_pick_commits
on:
push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
branch-matrix:
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:
name: Auto Cherry picking to branches
needs: branch-matrix
runs-on: ubuntu-latest
strategy:
matrix:
to_branch: ${{ fromJson(needs.branch-matrix.outputs.branches) }}
# skipping PRs remote target_branch from cherrypicking again in self with the if condition
if: ${{ matrix.to_branch }} != github.base_ref && contains(github.event.pull_request.labels.*.name, 'CherryPick')
steps:
- name: Checkout Robottelo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cherry pick into ${{ matrix.to_branch }}
uses: carloscastrojumo/[email protected]
with:
branch: ${{ matrix.to_branch }}
labels: |
Auto_Cherry_Picked