chore(deps): bump mongoose from 9.8.0 to 9.9.0 in /server in the npm-patch-minor group #256
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: Dependabot update branch (keep up-to-date) | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: dependabot-update-branch-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| update: | |
| if: ${{ github.event.pull_request.draft == false && github.event.pull_request.user.login == 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Update branch if behind | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const pr = context.payload.pull_request; | |
| const { owner, repo } = context.repo; | |
| const pull_number = pr.number; | |
| // mergeable_state 可能是 null/unknown(GitHub 需要时间计算),这里尽力检查并更新 | |
| const { data } = await github.rest.pulls.get({ owner, repo, pull_number }); | |
| core.info(`mergeable_state=${data.mergeable_state}, mergeable=${data.mergeable}`); | |
| if (data.mergeable_state !== 'behind') { | |
| core.info('PR is not behind base branch; skip update.'); | |
| return; | |
| } | |
| // 触发“Update branch”(等价于 UI 的 Update branch 按钮) | |
| // 需要 expected_head_sha 以避免竞态 | |
| await github.request('PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch', { | |
| owner, | |
| repo, | |
| pull_number, | |
| expected_head_sha: data.head.sha | |
| }); | |
| core.info('Update branch triggered.'); | |