2024-04-11 10:13:06 +00:00
|
|
|
name: Dependabot auto-merge
|
|
|
|
on:
|
2024-04-12 13:38:34 +00:00
|
|
|
- pull_request_target
|
2024-04-11 10:13:06 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
packages: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
dependabot:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: ${{ github.actor == 'dependabot[bot]' }}
|
|
|
|
steps:
|
|
|
|
- name: Dependabot metadata
|
|
|
|
id: metadata
|
2024-04-29 21:12:37 +00:00
|
|
|
uses: dependabot/fetch-metadata@v2.1.0
|
2024-04-11 10:13:06 +00:00
|
|
|
with:
|
|
|
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
skip-commit-verification: true
|
|
|
|
|
|
|
|
- name: Checkout repository
|
2024-04-13 17:01:17 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-04-11 10:13:06 +00:00
|
|
|
|
|
|
|
- name: Approve a PR if not already approved
|
|
|
|
run: |
|
|
|
|
gh pr checkout "$PR_URL"
|
|
|
|
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
|
|
|
|
then
|
|
|
|
gh pr review --approve "$PR_URL"
|
|
|
|
else
|
|
|
|
echo "PR already approved.";
|
|
|
|
fi
|
|
|
|
env:
|
|
|
|
PR_URL: ${{github.event.pull_request.html_url}}
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
|
|
|
|
- name: Enable auto-merge for Dependabot PRs
|
|
|
|
if: ${{ contains(github.event.pull_request.title, 'bump')}}
|
2024-04-12 13:59:25 +00:00
|
|
|
run: gh pr merge --auto --squash "$PR_URL"
|
2024-04-11 10:13:06 +00:00
|
|
|
env:
|
|
|
|
PR_URL: ${{github.event.pull_request.html_url}}
|
2024-04-12 13:57:13 +00:00
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|