-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (29 loc) · 1.48 KB
/
Copy pathenable-automerge.yml
File metadata and controls
39 lines (29 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Dependabot - Enable Auto-Merge
# Dependabot Pull Requests Auto-Merge
# This workflow does not execute the merge itself. Instead, it serves as a filter that enables GitHub's native Automatic Merging feature when conditions are met.
# The auto-merge will be enabled only if the semantic version for the changes is MINOR or PATCH.
# Pull Requests with semantic versions MAJOR will need manual review and approval.
# Once the version filter has enabled Auto-Merge, the Pull Request will enter a waiting state until all required checks defined in the master Branch Protection Rules are passed.
# The secured process is: Safe Version → Enable Auto-Merge → Wait for CI Tests → Automatic Merge.
on:
pull_request:
branches: ["master", "main"]
permissions:
contents: write
pull-requests: write
jobs:
dependabot-automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Obtain Dependabot Metadata
id: metadata
uses: dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36 #v3.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable Auto-Merge
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}