Repository navigation
feat: update API sources and regenerate #9506
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: Release Checks | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| branches: ['main'] | |
| permissions: | |
| contents: read | |
| jobs: | |
| # More info at https://github.com/Roave/BackwardCompatibilityCheck. | |
| backwards-compatibility-check: | |
| name: "Release Checks: Breaking Change Detector" | |
| runs-on: ubuntu-latest | |
| continue-on-error: ${{ contains(github.event.pull_request.body, 'BREAKING_CHANGE_REASON=') }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: "Install PHP" | |
| uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 | |
| with: | |
| php-version: "8.4" | |
| - name: "Install dependencies" | |
| run: | | |
| composer global require "roave/backward-compatibility-check:^8.22" | |
| composer install -d dev --no-interaction --no-progress | |
| - name: "Check for BC breaks" | |
| if: github.event.pull_request.user.login != 'release-please[bot]' | |
| env: | |
| HAS_BC_LABEL: ${{ contains(github.event.pull_request.title, '!:') }} | |
| run: | | |
| ./dev/google-cloud component:breaking-changes \ | |
| --base-ref="$(git merge-base origin/main HEAD)" \ | |
| --expect-breaking-changes=${HAS_BC_LABEL} \ | |
| --ga-only | |
| # Ensure the release PR does not contain an unexpected (e.g. 2.0.0) major version release | |
| # Add "MAJOR_VERSION_ALLOWED=component1,component2" to the PR description to allow major version | |
| # releases for those components | |
| unexpected-major-version-check: | |
| name: "Release Checks: Unexpected Major Version" | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.user.login == 'release-please[bot]' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Parse allowed major versions | |
| uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b # v2.0.2 | |
| id: allowed-major-versions | |
| with: | |
| text: ${{ github.event.pull_request.body }} | |
| regex: '^MAJOR_VERSION_ALLOWED=(.*)$' | |
| flags: gm | |
| - name: "Check for unexpected major version" | |
| run: | | |
| # parse allowed major versions into an array | |
| IFS=', ' read -r -a ALLOWED_MAJOR_VERSIONS <<< "${STEPS_ALLOWED_MAJOR_VERSIONS_OUTPUTS_GROUP1}" | |
| # get all changed components | |
| COMPONENTS=$(git diff origin/main --name-only | grep VERSION | xargs dirname) | |
| FAIL="" | |
| for COMPONENT in ${COMPONENTS}; do { | |
| if [[ "$(cat $COMPONENT/VERSION)" == [123456789].0.0 ]]; then | |
| # A new version is being released - make sure it's allowed | |
| if [[ ${ALLOWED_MAJOR_VERSIONS[@]} =~ $COMPONENT ]]; then | |
| echo "Major version release allowed: $COMPONENT" | |
| else | |
| echo "Unexpected major version release found: $COMPONENT" | |
| FAIL="true" | |
| fi | |
| fi | |
| }; done | |
| if [[ "$FAIL" == "true" ]]; then | |
| echo "⚠️ IMPORTANT ⚠️ This check is meant to prevent the accidental release of new major versions. New " | |
| echo "major versions should only be released intentionally. If you are not explicitly trying to release a " | |
| echo "new major version and you don't have explicit approval from the Language Lead, " | |
| echo "⚠️ DO NOT BYPASS THIS CHECK ⚠️" | |
| echo -e "\nAdd \"MAJOR_VERSION_ALLOWED=component1,component2\" to the PR description to allow " | |
| echo "major version releases for those components" | |
| exit 1 | |
| fi | |
| env: | |
| STEPS_ALLOWED_MAJOR_VERSIONS_OUTPUTS_GROUP1: ${{ steps.allowed-major-versions.outputs.group1 }} | |
| next-release-label-check: | |
| name: "Release Checks: Next Release Label" | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.user.login == 'release-please[bot]' | |
| steps: | |
| - name: Check for "next release" label | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const repos = [context.repo.repo, 'gapic-generator-php']; | |
| const openPRs = []; | |
| // check for open PRs which contain the 'next release' label | |
| for (const repo of repos) { | |
| const { data: pulls } = await github.rest.pulls.list({ | |
| owner: context.repo.owner, | |
| repo, | |
| state: 'open', | |
| per_page: 100, | |
| }); | |
| pulls.filter(pr => | |
| pr.labels.some(label => label.name === 'next release') | |
| ).forEach(pr => { | |
| const prefix = repo === context.repo.repo ? `#${pr.number}` : `${repo}#${pr.number}`; | |
| openPRs.push(` - ${prefix}: ${pr.title}`); | |
| }); | |
| } | |
| if (openPRs.length > 0) { | |
| const errorMessage = 'Found "next release" label on the following open pull requests:\n' | |
| + openPRs.join('\n') | |
| + '\nPlease merge them before release.'; | |
| core.setFailed(errorMessage); | |
| } else { | |
| console.log('No "next release" label found on any open pull requests!'); | |
| } | |
| # Ensure all repos are in compliance | |
| repo-compliance-check: | |
| name: "Release Checks: Repo Compliance" | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.user.login == 'release-please[bot]' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: "Install PHP" | |
| uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 | |
| with: | |
| php-version: "8.2" | |
| - name: "Install dependencies" | |
| run: composer install -d dev | |
| - name: "Check repo compliance" | |
| env: | |
| GH_TOKEN: ${{ secrets.SPLIT_TOKEN }} | |
| PG_TOKEN: ${{ secrets.PACKAGIST_SAFE_TOKEN }} | |
| run: | | |
| ./dev/google-cloud repo:compliance \ | |
| --format=ci \ | |
| -t $GH_TOKEN \ | |
| -p $PG_TOKEN |