|
6 | 6 | - labeled |
7 | 7 | - closed |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
9 | 12 | jobs: |
10 | 13 | prepare_branch_list: |
11 | 14 | runs-on: ubuntu-latest |
12 | 15 | if: | |
13 | 16 | github.event.pull_request.merged == true && |
14 | 17 | github.event.pull_request.merge_commit_sha != null |
| 18 | + permissions: |
| 19 | + pull-requests: write |
15 | 20 | outputs: |
16 | 21 | target_branch: ${{ steps.set-branches.outputs.target_branch }} |
17 | 22 | steps: |
18 | | - - name: Set Branches |
19 | | - id: set-branches |
20 | | - env: |
21 | | - PR_LABELS: ${{ toJson(github.event.pull_request.labels) }} |
22 | | - EVENT_ACTION: ${{ github.event.action }} |
23 | | - LABEL_NAME: ${{ github.event.label.name }} |
24 | | - BASE_REF: ${{ github.base_ref }} |
25 | | - run: | |
26 | | - if [[ $EVENT_ACTION == 'closed' ]]; then |
27 | | - # Get a list of the labels from the PR. |
28 | | - labels=$(echo "$PR_LABELS" | jq -r '.[].name') |
29 | | - else |
30 | | - # Or get the label that was added on the merged PR. |
31 | | - labels=$LABEL_NAME |
32 | | - fi |
| 23 | + - name: Auto-label PR |
| 24 | + uses: actions/labeler@v5 |
| 25 | + if: github.event.pull_request.merged == true && github.base_ref == 'main' |
| 26 | + with: |
| 27 | + repo-token: "${{ secrets.GITHUB_TOKEN }}" |
| 28 | + configuration-path: .github/config/infra/main_auto_cherry.yml |
33 | 29 |
|
34 | | - # This list must contain all cherry-pick destinations as file is used for all branches. |
35 | | - branches=("main" "26.eap" "26.android" "25.lts.1+" "24.lts.1+" "23.lts.1+" "22.lts.1+" "21.lts.1+" "20.lts.1+" "19.lts.1+" "rc_11" "COBALT_9") |
36 | | - filtered_branches=() |
37 | | - for branch in "${branches[@]}"; do |
38 | | - if [[ $branch == $BASE_REF ]]; then |
39 | | - continue |
40 | | - fi |
41 | | - if [[ ${labels[@]} =~ "cp-$branch" ]]; then |
42 | | - filtered_branches+=("$branch") |
| 30 | + - name: Set Branches |
| 31 | + id: set-branches |
| 32 | + env: |
| 33 | + PR_LABELS: ${{ toJson(github.event.pull_request.labels) }} |
| 34 | + EVENT_ACTION: ${{ github.event.action }} |
| 35 | + LABEL_NAME: ${{ github.event.label.name }} |
| 36 | + BASE_REF: ${{ github.base_ref }} |
| 37 | + run: | |
| 38 | + if [[ $EVENT_ACTION == 'closed' ]]; then |
| 39 | + # Get a list of the labels from the PR. |
| 40 | + labels=$(echo "$PR_LABELS" | jq -r '.[].name') |
| 41 | + else |
| 42 | + # Or get the label that was added on the merged PR. |
| 43 | + labels=$LABEL_NAME |
43 | 44 | fi |
44 | | - done |
45 | 45 |
|
46 | | - echo "target_branch=$(echo -n "${filtered_branches[@]}" | jq -cRs 'split(" ")')" >> $GITHUB_OUTPUT |
| 46 | + # This list must contain all cherry-pick destinations as file is used for all branches. |
| 47 | + branches=("main" "27.lts" "26.eap" "26.android" "25.lts.1+" "24.lts.1+" "23.lts.1+" "22.lts.1+" "21.lts.1+" "20.lts.1+" "19.lts.1+" "rc_11" "COBALT_9") |
| 48 | + filtered_branches=() |
| 49 | + for branch in "${branches[@]}"; do |
| 50 | + if [[ $branch == $BASE_REF ]]; then |
| 51 | + continue |
| 52 | + fi |
| 53 | + if [[ ${labels[@]} =~ "cp-$branch" ]]; then |
| 54 | + filtered_branches+=("$branch") |
| 55 | + fi |
| 56 | + done |
| 57 | +
|
| 58 | + echo "target_branch=$(echo -n "${filtered_branches[@]}" | jq -cRs 'split(" ")')" >> $GITHUB_OUTPUT |
47 | 59 |
|
48 | 60 | cherry_pick: |
49 | 61 | runs-on: ubuntu-latest |
|
0 commit comments