github.com/argoproj/argo-cd/v3@v3.2.1/.github/workflows/cherry-pick.yml (about)

     1  name: Cherry Pick
     2  
     3  on:
     4    pull_request_target:
     5      branches:
     6        - master
     7      types: ["labeled", "closed"]
     8  
     9  jobs:
    10    find-labels:
    11      name: Find Cherry Pick Labels
    12      if: |
    13        github.event.pull_request.merged == true && (
    14          (github.event.action == 'labeled' && startsWith(github.event.label.name, 'cherry-pick/')) ||
    15          (github.event.action == 'closed' && contains(toJSON(github.event.pull_request.labels.*.name), 'cherry-pick/'))
    16        )
    17      runs-on: ubuntu-latest
    18      outputs:
    19        labels: ${{ steps.extract-labels.outputs.labels }}
    20      steps:
    21        - name: Extract cherry-pick labels
    22          id: extract-labels
    23          run: |
    24            if [[ "${{ github.event.action }}" == "labeled" ]]; then
    25              # Label was just added - use it directly
    26              LABEL_NAME="${{ github.event.label.name }}"
    27              VERSION="${LABEL_NAME#cherry-pick/}"
    28              CHERRY_PICK_DATA='[{"label":"'$LABEL_NAME'","version":"'$VERSION'"}]'
    29            else
    30              # PR was closed - find all cherry-pick labels
    31              CHERRY_PICK_DATA=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -c '[.[] | select(.name | startswith("cherry-pick/")) | {label: .name, version: (.name | sub("cherry-pick/"; ""))}]')
    32            fi
    33  
    34            echo "labels=$CHERRY_PICK_DATA" >> "$GITHUB_OUTPUT"
    35            echo "Found cherry-pick data: $CHERRY_PICK_DATA"
    36  
    37    cherry-pick:
    38      name: Cherry Pick
    39      needs: find-labels
    40      if: needs.find-labels.outputs.labels != '[]'
    41      strategy:
    42        matrix:
    43          include: ${{ fromJSON(needs.find-labels.outputs.labels) }}
    44        fail-fast: false
    45      uses: ./.github/workflows/cherry-pick-single.yml
    46      with:
    47        merge_commit_sha: ${{ github.event.pull_request.merge_commit_sha }}
    48        version_number: ${{ matrix.version }}
    49        pr_number: ${{ github.event.pull_request.number }}
    50        pr_title: ${{ github.event.pull_request.title }}
    51      secrets:
    52        CHERRYPICK_APP_ID: ${{ vars.CHERRYPICK_APP_ID }}
    53        CHERRYPICK_APP_PRIVATE_KEY: ${{ secrets.CHERRYPICK_APP_PRIVATE_KEY }}