Skip to content

Commit d685148

Browse files
committed
chore(ci): add Dependabot auto-merge workflow
1 parent 3bade9a commit d685148

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Dependabot Auto Merge
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- labeled
10+
- unlabeled
11+
- ready_for_review
12+
pull_request_review:
13+
types: [submitted]
14+
check_suite:
15+
types: [completed]
16+
status: {}
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
22+
jobs:
23+
auto-merge:
24+
if: >-
25+
github.actor == 'dependabot[bot]' || github.actor == 'dependabot'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Set up Node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 22.x
34+
- name: Enable auto-merge if criteria met
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
PR_NUMBER=${{ github.event.pull_request.number }}
39+
# Fetch metadata
40+
echo "Evaluating PR #$PR_NUMBER from Dependabot"
41+
# Require all required checks to pass before auto-merge
42+
gh pr view $PR_NUMBER --json mergeStateStatus,reviewDecision,headRefName,labels,author || exit 0
43+
MERGE_STATE=$(gh pr view $PR_NUMBER --json mergeStateStatus -q .mergeStateStatus)
44+
if [ "$MERGE_STATE" != "CLEAN" ] && [ "$MERGE_STATE" != "HAS_HOOKS" ]; then
45+
echo "Merge state not clean ($MERGE_STATE). Skipping."; exit 0; fi
46+
# Optional: skip major version bumps unless label allow-major is present
47+
TITLE=$(gh pr view $PR_NUMBER --json title -q .title)
48+
if echo "$TITLE" | grep -Eqi '\\bmajor\\b'; then
49+
if ! gh pr view $PR_NUMBER --json labels -q '.labels[].name' | grep -q '^allow-major$'; then
50+
echo "Detected potential major bump. Add label 'allow-major' to permit auto-merge."; exit 0; fi
51+
fi
52+
# Approve if not already approved (Dependabot PRs sometimes need an approval)
53+
if gh pr view $PR_NUMBER --json reviewDecision -q .reviewDecision | grep -q "REVIEW_REQUIRED"; then
54+
gh pr review $PR_NUMBER --approve --body "Auto-approval for Dependabot update" || true
55+
fi
56+
# Attempt enable auto-merge (squash by default)
57+
gh pr merge $PR_NUMBER --auto --squash --delete-branch || true

distribution/popup/settings.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- Removed merge conflict markers -->
12
<!DOCTYPE html>
23
<html>
34

src/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* Merge conflict resolved: retaining original comprehensive utils implementation (pre-refactor). */
2+
/* Planned future: replace monolith with modular barrel once lib/ modules are finalised. */
3+
export * from './lib/index.js';
14
import {
25
shouldCapitaliseI,
36
shouldCapitaliseNames,

0 commit comments

Comments
 (0)