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
| # This script seperate major and minor but we do merge them into the same branch. | |
| # Having two steps allows us to easily turn off major changes in future and then script them to their own branch and pipeline. | |
| name: Auto-merge Dependabot PRs | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| branches: [Automatic_version_update_dependabot] # Make sure this matches your actual branch name | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| auto-merge: | |
| runs-on: ubuntu-latest | |
| if: github.actor == 'dependabot[bot]' | |
| steps: | |
| - name: Extract update type | |
| id: extract | |
| run: | | |
| PR_TITLE="${{ github.event.pull_request.title }}" | |
| if [[ $PR_TITLE == *"(major)"* ]]; then | |
| echo "update_type=major" >> $GITHUB_OUTPUT | |
| else | |
| echo "update_type=minor_or_patch" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Auto-merge minor and patch updates | |
| if: steps.extract.outputs.update_type == 'minor_or_patch' | |
| run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Auto-merge major updates | |
| if: steps.extract.outputs.update_type == 'major' | |
| run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |