|
| 1 | +# Copyright 2026 ResQ |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Auto-merge Dependabot |
| 16 | + |
| 17 | +on: |
| 18 | + pull_request: |
| 19 | + branches: [main] |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + pull-requests: write |
| 24 | + |
| 25 | +jobs: |
| 26 | + auto-merge: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 5 |
| 29 | + if: github.actor == 'dependabot[bot]' |
| 30 | + steps: |
| 31 | + - name: Fetch Dependabot metadata |
| 32 | + id: metadata |
| 33 | + uses: dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36 # v3 |
| 34 | + with: |
| 35 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + |
| 37 | + - name: Rebase onto main |
| 38 | + if: > |
| 39 | + steps.metadata.outputs.update-type == 'version-update:semver-minor' || |
| 40 | + steps.metadata.outputs.update-type == 'version-update:semver-patch' |
| 41 | + run: gh pr comment "$PR_URL" --body "@dependabot rebase" |
| 42 | + env: |
| 43 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 44 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + |
| 46 | + - name: Auto-merge minor and patch updates |
| 47 | + if: > |
| 48 | + steps.metadata.outputs.update-type == 'version-update:semver-minor' || |
| 49 | + steps.metadata.outputs.update-type == 'version-update:semver-patch' |
| 50 | + run: gh pr merge --auto --squash "$PR_URL" |
| 51 | + env: |
| 52 | + PR_URL: ${{ github.event.pull_request.html_url }} |
| 53 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments