chore: π Update SDK - Generate 0.27.82 #45
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: Auto-merge generated SDK PRs | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize, labeled, ready_for_review] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| enable-automerge: | |
| if: > | |
| (github.event.pull_request.user.login == 'github-actions' || | |
| github.event.pull_request.user.login == 'github-actions[bot]') && | |
| startsWith(github.event.pull_request.title, 'chore: π Update SDK - Generate') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check labels (needs minor or patch) | |
| id: labels | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const prNumber = context.payload.pull_request.number; | |
| const { data: labels } = await github.rest.issues.listLabelsOnIssue({ owner, repo, issue_number: prNumber }); | |
| const names = labels.map(l => l.name.toLowerCase()); | |
| core.setOutput('match', names.includes('minor') || names.includes('patch')); | |
| - name: Auto-approve pull request | |
| if: steps.labels.outputs.match == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const prNumber = context.payload.pull_request.number; | |
| try { | |
| await github.rest.pulls.createReview({ | |
| owner, | |
| repo, | |
| pull_number: prNumber, | |
| event: 'APPROVE', | |
| body: 'Auto-approved: SDK update with minor/patch label' | |
| }); | |
| } catch (error) { | |
| core.warning(`Failed to approve PR: ${error.message}. If using GITHUB_TOKEN, you may need to create a Personal Access Token (PAT) and store it as GH_PAT secret.`); | |
| throw error; | |
| } | |
| - name: Enable auto-merge (squash) | |
| if: steps.labels.outputs.match == 'true' | |
| uses: peter-evans/enable-pull-request-automerge@v3 | |
| with: | |
| pull-request-number: ${{ github.event.pull_request.number }} | |
| merge-method: squash | |
| token: ${{ secrets.GITHUB_TOKEN }} | |