Skip to content

chore: multi dotnet versions #5

chore: multi dotnet versions

chore: multi dotnet versions #5

name: dependabot-auto-approve-and-merge
on: pull_request
permissions:
contents: read
pull-requests: read
jobs:
dependabot-auto-approve-and-merge:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
# Checking the author and fork will prevent your Action run failing on non-Dependabot PRs
if: |
github.event.repository.fork == false &&
github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Dependabot metadata
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
id: dependabot-metadata
- name: Check for merge conflicts
uses: sv-tools/block-merge-conflicts@2fb5852d0efb87ecceed7a3d24ad657dccf47a64 # v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Approve a PR if not already approved
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: |
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then gh pr review --approve "$PR_URL" && gh pr merge --auto --squash "${PR_URL}"
else echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Auto-merge
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}