Skip to content

Commit 3ff23da

Browse files
committed
chore(ci): configure Dependabot metadata labels (semver, ecosystem, dependency-type)
1 parent b8624ae commit 3ff23da

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ updates:
1212
- 'GizzZmo'
1313
labels:
1414
- 'dependencies'
15+
- 'npm'
1516
- 'automated'
1617
commit-message:
1718
prefix: 'chore(deps):'

.github/workflows/auto-merge-dependabot.yml

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
permissions:
88
contents: write
99
pull-requests: write
10+
issues: write
1011

1112
jobs:
1213
auto-merge:
@@ -21,6 +22,64 @@ jobs:
2122
with:
2223
github-token: '${{ secrets.GITHUB_TOKEN }}'
2324

25+
- name: Ensure metadata labels exist
26+
run: |
27+
# Create SemVer + dependency-type labels if missing (idempotent)
28+
declare -A LABELS=(
29+
["semver-major"]="Major version bump — requires manual review"
30+
["semver-minor"]="Minor version bump"
31+
["semver-patch"]="Patch version bump"
32+
["production"]="Production / runtime dependency"
33+
["development"]="Development / tooling dependency"
34+
["npm"]="npm package ecosystem"
35+
["github-actions"]="GitHub Actions ecosystem"
36+
)
37+
for name in "${!LABELS[@]}"; do
38+
gh label create "$name" \
39+
--description "${LABELS[$name]}" \
40+
--color "0366d6" \
41+
--force 2>/dev/null || true
42+
done
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Apply Dependabot metadata labels
47+
run: |
48+
PR_URL="${{ github.event.pull_request.html_url }}"
49+
LABELS=()
50+
51+
# SemVer labels from update-type
52+
case "${{ steps.metadata.outputs.update-type }}" in
53+
version-update:semver-major) LABELS+=("semver-major") ;;
54+
version-update:semver-minor) LABELS+=("semver-minor") ;;
55+
version-update:semver-patch) LABELS+=("semver-patch") ;;
56+
esac
57+
58+
# Dependency type (direct:production / direct:development / indirect)
59+
DEP_TYPE="${{ steps.metadata.outputs.dependency-type }}"
60+
if [[ "$DEP_TYPE" == *"production"* ]]; then
61+
LABELS+=("production")
62+
elif [[ "$DEP_TYPE" == *"development"* ]]; then
63+
LABELS+=("development")
64+
fi
65+
66+
# Package ecosystem
67+
case "${{ steps.metadata.outputs.package-ecosystem }}" in
68+
npm) LABELS+=("npm") ;;
69+
github_actions) LABELS+=("github-actions") ;;
70+
esac
71+
72+
# Apply any collected labels
73+
if [ ${#LABELS[@]} -gt 0 ]; then
74+
LABEL_ARGS=$(printf -- '--add-label %s ' "${LABELS[@]}")
75+
gh pr edit "$PR_URL" $LABEL_ARGS
76+
echo "Applied labels: ${LABELS[*]}"
77+
else
78+
echo "No additional metadata labels to apply"
79+
fi
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
2483
- name: Check if safe to auto-merge
2584
id: check_safe
2685
run: |
@@ -55,5 +114,5 @@ jobs:
55114
issue_number: context.issue.number,
56115
owner: context.repo.owner,
57116
repo: context.repo.repo,
58-
body: '⚠️ **Major version update detected!** Please review this PR manually before merging.'
117+
body: '⚠️ **Major version update detected!** Please review this PR manually before merging.\n\nLabel `semver-major` has been applied for triage.'
59118
})

0 commit comments

Comments
 (0)