-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (111 loc) · 4.46 KB
/
modules-pr-labeler.yml
File metadata and controls
119 lines (111 loc) · 4.46 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: 📦 Module | PR Labeler & Triage
on:
workflow_call:
inputs:
config-path:
description: 'Path to labeler configuration file'
required: false
type: string
default: '.github/config/pr-labeler/path-labels.yml'
sync-labels:
description: 'Remove labels when files no longer match'
required: false
type: boolean
default: true
auto-assign:
description: 'Automatically assign reviewers based on CODEOWNERS'
required: false
type: boolean
default: false
size-labels:
description: 'Add size labels (XS, S, M, L, XL, XXL)'
required: false
type: boolean
default: true
priority-labels:
description: 'Add priority labels based on keywords'
required: false
type: boolean
default: true
type-labels:
description: 'Add type labels based on branch names and PR title'
required: false
type: boolean
default: true
custom-rules:
description: 'Path to custom triage rules file'
required: false
type: string
default: '.github/config/pr-labeler/triage-rules.yml'
runs-on:
description: 'Runner to use. Use string for GitHub-hosted (e.g., "ubuntu-latest") or JSON array for self-hosted (e.g., ["self-hosted", "linux"])'
required: false
type: string
default: 'ubuntu-latest'
secrets:
token:
description: 'GitHub Token with pull-requests write permission'
required: false
outputs:
labels-added:
description: 'Labels added to the PR'
value: ${{ jobs.labeler.outputs.labels-added }}
size-label:
description: 'Size label applied'
value: ${{ jobs.labeler.outputs.size-label }}
priority-label:
description: 'Priority label applied'
value: ${{ jobs.labeler.outputs.priority-label }}
all-labels:
description: 'All current PR labels'
value: ${{ jobs.labeler.outputs.all-labels }}
permissions:
contents: read
pull-requests: write
jobs:
labeler:
name: 🏷️ Label & Triage PR
runs-on: ${{ startsWith(inputs.runs-on, '[') && fromJSON(inputs.runs-on) || inputs.runs-on }}
outputs:
labels-added: ${{ steps.triage.outputs.labels-added }}
size-label: ${{ steps.triage.outputs.size-label }}
priority-label: ${{ steps.triage.outputs.priority-label }}
all-labels: ${{ steps.triage.outputs.all-labels }}
steps:
- name: 🚀 Checkout Repository
uses: actions/checkout@v6
with:
token: ${{ secrets.token || secrets.GITHUB_TOKEN }}
- name: 🏷️ Run Labeler & Triage
id: triage
uses: bauer-group/automation-templates/.github/actions/labeler-triage@main
with:
token: ${{ secrets.token || secrets.GITHUB_TOKEN }}
config-path: ${{ inputs.config-path }}
sync-labels: ${{ inputs.sync-labels }}
auto-assign: ${{ inputs.auto-assign }}
size-labels: ${{ inputs.size-labels }}
priority-labels: ${{ inputs.priority-labels }}
type-labels: ${{ inputs.type-labels }}
custom-rules: ${{ inputs.custom-rules }}
- name: 📊 Label Summary
if: always()
run: |
echo "### 🏷️ Pull Request Labeling Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Category | Labels |" >> $GITHUB_STEP_SUMMARY
echo "|----------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| **Size** | ${{ steps.triage.outputs.size-label || 'Not determined' }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Priority** | ${{ steps.triage.outputs.priority-label || 'Not set' }} |" >> $GITHUB_STEP_SUMMARY
echo "| **All Labels** | ${{ steps.triage.outputs.all-labels || 'None' }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Add label statistics
if [ -n "${{ steps.triage.outputs.all-labels }}" ]; then
LABEL_COUNT=$(echo "${{ steps.triage.outputs.all-labels }}" | tr ',' '\n' | wc -l)
echo "**Total Labels:** $LABEL_COUNT" >> $GITHUB_STEP_SUMMARY
else
echo "**Total Labels:** 0" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "---" >> $GITHUB_STEP_SUMMARY
echo "*Automated labeling powered by PR Labeler & Triage* 🤖" >> $GITHUB_STEP_SUMMARY