ci: enable autonomous releases #4
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 Dependabot when green | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize, labeled] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| enable-automerge: | |
| runs-on: ubuntu-latest | |
| if: github.actor == 'dependabot[bot]' | |
| steps: | |
| - name: Find PR number via GitHub API | |
| id: find | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const {owner, repo} = context.repo; | |
| const head = `${owner}:${context.payload.pull_request.head.ref}`; | |
| const prs = await github.rest.pulls.list({ owner, repo, head, state: 'open' }); | |
| if (!prs.data.length) core.setFailed('No PR found for head ' + head); | |
| core.setOutput('number', prs.data[0].number); | |
| - name: Enable auto-merge (squash) & delete branch | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh pr merge "${{ steps.find.outputs.number }}" --auto --squash --delete-branch --admin |