PR - Dependabot auto merge #384
This file contains 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: PR - Dependabot auto merge | |
on: | |
workflow_run: | |
workflows: ["Build and test"] | |
types: | |
- completed | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
auto-merge-pr: | |
name: Auto merge dependabot PR | |
if: github.actor == 'dependabot[bot]' && github.event.workflow_run.conclusion == 'success' | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump github context for debug purposes | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
run: $env:GITHUB_CONTEXT | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.workflow_run.head_sha }} | |
- name: Approve and merge dependabot PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
$prNumber = "${{ github.event.workflow_run.pull_requests[0].number }}" | |
gh pr merge --auto --squash --delete-branch $prNumber |