|
6 | 6 | types:
|
7 | 7 | - closed
|
8 | 8 |
|
| 9 | +# Github & Parent PR Env vars |
| 10 | +env: |
| 11 | + assignee: ${{ github.event.pull_request.assignee.login }} |
| 12 | + title: ${{ github.event.pull_request.title }} |
| 13 | + number: ${{ github.event.number }} |
| 14 | + |
9 | 15 | jobs:
|
10 |
| - previous-branch: |
11 |
| - if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') |
12 |
| - name: Calculate previous branch name |
13 |
| - runs-on: ubuntu-latest |
14 |
| - outputs: |
15 |
| - previous_branch: ${{ steps.set-branch.outputs.previous_branch }} |
16 |
| - steps: |
17 |
| - - uses: actions/checkout@v3 |
18 |
| - with: |
19 |
| - fetch-depth: 0 |
20 |
| - - id: set-branch |
21 |
| - run: echo "previous_branch=$(if [ $GITHUB_BASE_REF == 'master' ]; then echo $(git branch -rl 'origin/6.*.z' --format='%(refname:lstrip=-1)' | sort --version-sort | tail -n1); else echo '6.'$(($(echo $GITHUB_BASE_REF | cut -d. -f2) - 1))'.z'; fi)" >> $GITHUB_OUTPUT |
22 | 16 |
|
| 17 | + # Auto CherryPicking and Failure Recording |
23 | 18 | auto-cherry-pick:
|
24 |
| - name: Auto Cherry Pick to previous branch |
25 | 19 | if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick')
|
26 |
| - needs: previous-branch |
| 20 | + name: Auto Cherry Pick to labeled branches |
27 | 21 | runs-on: ubuntu-latest
|
28 |
| - env: |
29 |
| - TO_BRANCH: ${{ needs.previous-branch.outputs.previous_branch }} |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + label: ${{ github.event.pull_request.labels.*.name }} |
| 25 | + |
30 | 26 | steps:
|
| 27 | + ## Nailgun Repo Checkout |
31 | 28 | - uses: actions/checkout@v3
|
| 29 | + if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} |
32 | 30 | with:
|
33 | 31 | fetch-depth: 0
|
34 |
| - - name: Cherry pick into ${{ env.TO_BRANCH }} |
| 32 | + |
| 33 | + ## CherryPicking and AutoMerging |
| 34 | + - name: Cherrypicking to zStream branch |
| 35 | + id: cherrypick |
| 36 | + if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} |
35 | 37 | uses: jyejare/github-cherry-pick-action@main
|
36 | 38 | with:
|
37 | 39 | token: ${{ secrets.CHERRYPICK_PAT }}
|
38 |
| - branch: ${{ env.TO_BRANCH }} |
| 40 | + branch: ${{ matrix.label }} |
39 | 41 | labels: |
|
40 | 42 | Auto_Cherry_Picked
|
41 |
| - ${{ env.TO_BRANCH }} |
42 |
| - assignees: "${{ github.event.pull_request.assignee.login }}" |
| 43 | + ${{ matrix.label }} |
| 44 | + assignees: ${{ env.assignee }} |
43 | 45 |
|
44 |
| - create-issue: |
45 |
| - runs-on: ubuntu-latest |
46 |
| - if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} |
47 |
| - needs: [previous-branch, auto-cherry-pick] |
48 |
| - env: |
49 |
| - TO_BRANCH: ${{ needs.previous-branch.outputs.previous_branch }} |
50 |
| - steps: |
51 |
| - - name: Create Issue on Failed Auto Cherrypick |
| 46 | + ## Failure Logging to issues and GChat Group |
| 47 | + - name: Create Github issue on cherrypick failure |
| 48 | + id: create-issue |
| 49 | + if: ${{ always() && steps.cherrypick.outcome == 'failure' }} |
52 | 50 | uses: dacbd/create-issue-action@main
|
53 | 51 | with:
|
54 | 52 | token: ${{ secrets.CHERRYPICK_PAT }}
|
55 |
| - title: "[Failed-AutoCherryPick] - ${{ github.event.pull_request.title }}" |
| 53 | + title: "[Failed-AutoCherryPick] - ${{ env.title }}" |
56 | 54 | body: |
|
57 | 55 | #### Auto-Cherry-Pick WorkFlow Failure:
|
58 |
| - - To Branch: ${{ env.TO_BRANCH }} |
| 56 | + - To Branch: ${{ matrix.label }} |
59 | 57 | - [Failed Cherrypick Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
60 |
| - - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ github.event.number }}) |
61 |
| - labels: Failed_AutoCherryPick,${{ env.TO_BRANCH }} |
62 |
| - assignees: "${{ github.event.pull_request.assignee.login }}" |
63 |
| - |
64 |
| - google-chat-notification: |
65 |
| - runs-on: ubuntu-latest |
66 |
| - if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} |
67 |
| - needs: auto-cherry-pick |
68 |
| - steps: |
69 |
| - - name: Google Chat Notification - Airgun |
70 |
| - uses: Co-qn/google-chat-notification@releases/v1 |
| 58 | + - [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ env.number }}) |
| 59 | + labels: Failed_AutoCherryPick,${{ matrix.label }} |
| 60 | + assignees: ${{ env.assignee }} |
| 61 | + - name: Send Google Chat notification on cherrypick failure |
| 62 | + id: google-chat-notification |
| 63 | + if: ${{ always() && steps.cherrypick.outcome == 'failure' }} |
| 64 | + uses: omkarkhatavkar/google-chat-notification@master |
71 | 65 | with:
|
72 |
| - name: "${{ github.event.pull_request.title }}" |
| 66 | + name: ${{ env.title }} |
73 | 67 | url: ${{ secrets.GCHAT_REVIEWERS_WEBHOOK }}
|
| 68 | + issue_url: ${{ steps.create-issue.outputs.html_url }} |
| 69 | + author: ${{ env.assignee }} |
74 | 70 | status: failure
|
0 commit comments