Dependabot Auto-merge #663
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 Auto-merge | |
| on: | |
| workflow_run: | |
| workflows: ["CI"] | |
| types: | |
| - completed | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| auto-merge: | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event.workflow_run.actor.login == 'dependabot[bot]' && | |
| github.event.workflow_run.conclusion == 'success' && | |
| github.event.workflow_run.event == 'pull_request' | |
| steps: | |
| - name: Get PR number | |
| id: pr | |
| run: | | |
| PR_NUMBER=$(gh run view ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} --json pullRequests --jq '.pullRequests[0].number') | |
| echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Fetch Dependabot metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@v2 | |
| with: | |
| github-token: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Merge PR for patch and minor updates | |
| if: | | |
| steps.metadata.outputs.update-type != 'version-update:semver-major' && | |
| !( | |
| steps.metadata.outputs.directory == '/webapp' && | |
| steps.metadata.outputs.update-type == 'version-update:semver-minor' && | |
| ( | |
| contains(steps.metadata.outputs.dependency-names, 'apexcharts') || | |
| contains(steps.metadata.outputs.dependency-names, 'react-apexcharts') || | |
| contains(steps.metadata.outputs.dependency-names, '@nivo/') | |
| ) | |
| ) | |
| run: gh pr merge --squash "${{ steps.pr.outputs.number }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |