chore(deps): Bump net.snowflake:snowflake-jdbc from 3.23.0 to 3.23.1 #3497
Workflow file for this run
This file contains hidden or 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
| name: Cherry-pick PRs to release branches | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: ["closed", "labeled"] | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: "PR number to cherry-pick" | |
| required: true | |
| type: number | |
| base_version: | |
| description: "Base version to cherry-pick since" | |
| default: "2.1" | |
| required: true | |
| type: string | |
| env: | |
| GH_TOKEN: ${{ secrets.RISINGWAVE_CI_GITHUB_TOKEN }} | |
| jobs: | |
| get-target-release-branches: | |
| if: | | |
| (github.event_name == 'pull_request' && | |
| github.event.pull_request.merged && | |
| ((github.event.action == 'labeled' && startsWith(github.event.label.name, 'need-cherry-pick-since')) || | |
| (github.event.action == 'closed' && contains(toJson(github.event.pull_request.labels), 'need-cherry-pick-since')))) || | |
| github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| branches: ${{ steps.filter-release-branches.outputs.branches }} | |
| pr_number: ${{ steps.filter-release-branches.outputs.pr_number }} | |
| pr_sha: ${{ steps.filter-release-branches.outputs.pr_sha }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Ensures all branches are fetched | |
| - name: Get all release branches including label version and higher | |
| id: filter-release-branches | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| # For manual workflow dispatch | |
| base_version="${{ github.event.inputs.base_version }}" | |
| pr_number="${{ github.event.inputs.pr_number }}" | |
| echo "Using manually provided base version: $base_version for PR #$pr_number" | |
| # Get the PR merge commit SHA | |
| pr_sha=$(gh pr view $pr_number --repo ${{ github.repository }} --json mergeCommit --jq .mergeCommit.oid) | |
| echo "PR merge commit SHA: $pr_sha" | |
| echo "pr_sha=$pr_sha" >> "$GITHUB_OUTPUT" | |
| else | |
| # For automatic trigger from PR events | |
| if [[ "${{ github.event.action }}" == 'labeled' ]]; then | |
| label="${{ github.event.label.name }}" | |
| else | |
| labels='${{ toJson(github.event.pull_request.labels) }}' | |
| label=$(echo "$labels" | jq -r '.[] | select(.name | contains("need-cherry-pick-since")).name' | sort -V | head -n 1) | |
| fi | |
| base_version=$(echo "$label" | sed 's/need-cherry-pick-since-release-//') | |
| pr_number="${{ github.event.number }}" | |
| fi | |
| # Output the PR number for use in downstream jobs | |
| echo "PR number: $pr_number" | |
| echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT" | |
| echo "Base version from label: $base_version" | |
| branches=$(git branch -r | grep "origin/release-" | sed 's|origin/release-||' | sort -V) | |
| echo "Branches: $branches" | |
| target_branches=() | |
| while IFS= read -r version; do | |
| version=$(echo "$version" | xargs) | |
| if [[ ! "$version" =~ ^[0-9]+(\.[0-9]+)*$ ]]; then | |
| echo "Skipping non-numeric branch: release-$version" | |
| continue | |
| fi | |
| if [[ -n "$version" ]] && [[ "$version" == "$(printf "%s\n%s" "$base_version" "$version" | sort -V | tail -n1)" ]]; then | |
| target_branches+=("release-$version") | |
| fi | |
| done <<< "$branches" | |
| if [ ${#target_branches[@]} -eq 0 ]; then | |
| echo "No matching release branches found." | |
| echo "branches=[]" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "Matching release branches found:" | |
| for branch in "${target_branches[@]}"; do | |
| echo "$branch" | |
| done | |
| echo "branches=$(printf '%s\n' "${target_branches[@]}" | jq -R . | jq -s -c .)" >> "$GITHUB_OUTPUT" | |
| fi | |
| release_pull_request: | |
| needs: get-target-release-branches | |
| if: needs.get-target-release-branches.outputs.branches != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| branch: ${{ fromJson(needs.get-target-release-branches.outputs.branches) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Create PR to branch | |
| uses: risingwavelabs/github-action-cherry-pick@master | |
| with: | |
| # For automatic trigger from PR events, `pr_sha` is unset, | |
| # and it will use the triggering SHA (GITHUB_SHA) instead. | |
| commit_sha: ${{ needs.get-target-release-branches.outputs.pr_sha || '' }} | |
| pr_branch: ${{ matrix.branch }} | |
| pr_labels: "cherry-pick" | |
| pr_body: "Cherry picking #${{ needs.get-target-release-branches.outputs.pr_number }} onto branch ${{ matrix.branch }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RISINGWAVE_CI_GITHUB_TOKEN }} | |
| # This job runs after all cherry-pick attempts and reports the final status | |
| report_status: | |
| needs: [get-target-release-branches, release_pull_request] | |
| if: always() && needs.get-target-release-branches.result == 'success' && needs.get-target-release-branches.outputs.branches != '[]' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Report final status | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const jobStatus = '${{ needs.release_pull_request.result }}'; | |
| const prNumber = ${{ needs.get-target-release-branches.outputs.pr_number }}; | |
| if (jobStatus === 'success') { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: '✅ Cherry-pick PRs (or issues if encountered conflicts) have been created successfully to all target branches.' | |
| }); | |
| } else if (jobStatus === 'failure') { | |
| const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: `❌ Cherry-pick failed for one or more branches. Please check the [workflow run logs](${runUrl}) and consider retrying or manually cherry-picking.` | |
| }); | |
| } | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| contents: write | |
| actions: write |