Repository navigation
Assert on structured log events in common.ai tests (#74443) #15124
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
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # | |
| --- | |
| name: Automatic Backport | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| get-pr-info: | |
| name: "Get PR information" | |
| runs-on: ubuntu-slim | |
| outputs: | |
| branches: ${{ steps.pr-info.outputs.branches }} | |
| commit-sha: ${{ github.sha }} | |
| steps: | |
| - name: Get commit SHA | |
| id: get-sha | |
| run: echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV | |
| # Adding a slight delay to allow GitHub's API to associate the merge commit with the PR. | |
| # This is needed because GH has a consistency of 6-10+ seconds | |
| # to process the commit and PR association after a merge based on some of our past runs. | |
| # Without this delay, the listPullRequestsAssociatedWithCommit API call may return an empty array | |
| # even though a PR was just merged, causing backports to be skipped. | |
| - name: Add delay for GitHub to process PR merge | |
| run: sleep 15 | |
| - name: Find PR information | |
| id: pr-info | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Branches fast-forwarded to main during a beta phase - a backport PR there would make | |
| # them diverge from main. Empty this list when the RCs start (see "Beta releases" | |
| # in dev/README_RELEASE_AIRFLOW.md). | |
| BACKPORT_PAUSED_BRANCHES: '["v3-4-test"]' | |
| with: | |
| script: | | |
| const pausedBranches = JSON.parse(process.env.BACKPORT_PAUSED_BRANCHES); | |
| const { data: pullRequest } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| commit_sha: process.env.GITHUB_SHA | |
| }); | |
| if (pullRequest.length > 0) { | |
| const pr = pullRequest[0]; | |
| const backportBranches = pr.labels | |
| .filter(label => label.name.startsWith('backport-to-')) | |
| .map(label => label.name.replace('backport-to-', '')) | |
| .filter(branch => { | |
| if (pausedBranches.includes(branch)) { | |
| console.log(`⚠️ Skipping backport to ${branch}: backports to it are paused.`); | |
| return false; | |
| } | |
| return true; | |
| }); | |
| console.log(`Commit ${process.env.GITHUB_SHA} is associated with PR ${pr.number}`); | |
| console.log(`Backport branches: ${backportBranches}`); | |
| core.setOutput('branches', JSON.stringify(backportBranches)); | |
| } else { | |
| console.log('⚠️ No pull request found for this commit.'); | |
| core.setOutput('branches', '[]'); | |
| } | |
| trigger-backport: | |
| name: "Trigger Backport" | |
| uses: ./.github/workflows/backport-cli.yml | |
| needs: get-pr-info | |
| if: ${{ needs.get-pr-info.outputs.branches != '[]' }} | |
| strategy: | |
| matrix: | |
| branch: ${{ fromJSON(needs.get-pr-info.outputs.branches) }} | |
| fail-fast: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| with: | |
| target-branch: ${{ matrix.branch }} | |
| commit-sha: ${{ needs.get-pr-info.outputs.commit-sha }} |