PR workflow, add labels based on files/branch name - Add PR labels based on changed files - Add PR labels based on branch names

84e7ddbf743ca9f59d8fca1b0dbeae5c2ae3af1d

Wolfsblvt <wolfsblvt@gmail.com>

3 files changed, +108 -14Showing whitespace changes
.github/pr-auto-labels-by-branch.yml+77 -0
@@ -0,0 +1,77 @@
1+####################################
2+# Label PRs against 'release' #
3+####################################
4+❗ Against Release Branch:
5+- base-branch: 'release'
6+
7+####################################
8+# Labels based on PR branch name #
9+####################################
10+πŸ¦‹ Bug Fix:
11+- head-branch: ['^fix[/-]', '\bfixes\b']
12+
13+πŸš‘ Hot Fix:
14+- head-branch: ['^hotfix[/-]']
15+
16+✨ New Feature:
17+- head-branch: ['^feat(ure)?[/-].*?\badd', '^add-']
18+
19+✨ Feature Changes:
20+- head-branch: ['^feat(ure)?[/-](?!.*\badd\b)', '\bchanges?\b']
21+
22+πŸ€– API / Model:
23+- head-branch: ['\bapi\b', '\bmodels?\b']
24+
25+🏭 Backend Changes:
26+- head-branch: ['\bbackend\b', '\bendpoints?\b']
27+
28+πŸ‹ Docker:
29+- head-branch: ['\bdocker\b']
30+
31+βž• Extension:
32+- head-branch: ['\bextension\b', '\bext\b']
33+
34+🦊 Firefox:
35+- head-branch: ['\bfirefox\b']
36+
37+πŸ–ΌοΈ Image Gen:
38+- head-branch: ['\bimage-gen\b']
39+
40+🌐 Language:
41+- head-branch: ['\btranslations?\b', '\blanguages?\b']
42+
43+🐧 Linux:
44+- head-branch: ['\blinux\b']
45+
46+🧩 Macros:
47+- head-branch: ['\bmacros?\b']
48+
49+πŸ“± Mobile:
50+- head-branch: ['\bmobile\b', '\bios\b', '\bandroid\b']
51+
52+πŸš„ Performance:
53+- head-branch: ['\bperformance\b']
54+
55+βš™οΈ Preset:
56+- head-branch: ['\bpresets?\b']
57+
58+πŸ“œ Prompt:
59+- head-branch: ['\bprompt\b']
60+
61+🚚 Refactor:
62+- head-branch: ['\brefactor(s|ed)?\b']
63+
64+πŸ“œ STscript:
65+- head-branch: ['\bstscript\b', '\bslash-commands\b']
66+
67+🏷️ Tags / Folders:
68+- head-branch: ['\btags\b']
69+
70+πŸŽ™οΈ TTS / Voice:
71+- head-branch: ['\btts\b', '\bvoice\b']
72+
73+🌟 UX:
74+- head-branch: ['\bux\b']
75+
76+πŸ—ΊοΈ World Info:
77+- head-branch: ['\bworld-info\b', '\bwi\b']
.github/pr-auto-labels,yml β†’ .github/pr-auto-labels-by-files.yml+11 -0
@@ -1,4 +1,9 @@
1+####################################
2+# Labels based on changed files #
3+####################################
14🏭 Backend Changes:
5+- changed-files:
6+ - any-glob-to-any-file:
27 - "src/**"
38 - "server.js"
49 - "plugins.js"
@@ -10,6 +15,8 @@
1015 - "UpdateForkAndStart.bat"
1116
1217πŸ› οΈ Build Changes:
18+- changed-files:
19+ - any-glob-to-any-file:
1320 - ".github/workflows/**"
1421 - "docker/**"
1522 - ".dockerignore"
@@ -17,9 +24,13 @@
1724 - "webpack.config.js"
1825
1926🌐 Language:
27+- changed-files:
28+ - any-glob-to-any-file:
2029 - "public/locales/**"
2130
2231πŸ“₯ Dependencies:
32+- changed-files:
33+ - any-glob-to-any-file:
2334 - "public/lib/**" # Every frontend lib counts as a dependency as well
2435 - "package.json"
2536 - "package-lock.json"
.github/workflows/pr-auto-manager.yml+20 -14
@@ -20,7 +20,7 @@ jobs:
2020 commentOnDirty: >
2121 ⚠️ This PR has conflicts that need to be resolved before it can be merged.
2222
2323 prlabel-sizeby-labelersize:
2424 name: Apply Label for PR Size
2525 runs-on: ubuntu-latest
2626
@@ -50,19 +50,22 @@ jobs:
5050 "package-lock.json"
5151 "public/lib/*"
5252
5353 label-releaseby-prsbranches:
5454 name: LabelApply PRsLabels TargetingBased Releaseon Branch Name and Target Branch
5555 runs-on: ubuntu-latest
56+ # Only label once when PR is created or branches are changed, to allow manual label removal
57+ if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head))
5658
5759 steps:
5860 - name: LabelApply PRsLabels TargetingBased Releaseon Branch Name and Target Branch
59- if: github.base_ref == 'release'
61+ # Pull Request Labeler
60- run: |
62+ # https://github.com/marketplace/actions/labeler
61- gh pr edit ${{ github.event.pull_request.number }} --add-label "❗ Against Release Branch"
63+ uses: actions/labeler@v5
6264 envwith:
63- GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
65+ configuration-path: .github/pr-auto-labels-by-branch.yml
66+ repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
6467
6568 apply-filelabel-basedby-labelsfiles:
6669 name: Apply Labels Based on Changed Files
6770 runs-on: ubuntu-latest
6871
@@ -72,11 +75,12 @@ jobs:
7275 # https://github.com/marketplace/actions/labeler
7376 uses: actions/labeler@v5
7477 with:
78+ configuration-path: .github/pr-auto-labels-by-files.yml
7579 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
7680
7781 check-merge-blocking-labels:
7882 name: Check Merge Blocking Labels
7983 needs: [check-merge-conflicts, prlabel-sizeby-labelersize, label-releaseby-prsbranches, apply-filelabel-basedby-labelsfiles]
8084 runs-on: ubuntu-latest
8185
8286 steps:
@@ -89,6 +93,7 @@ jobs:
8993 script: |
9094 const prLabels = context.payload.pull_request.labels.map(label => label.name);
9195 const blockingLabels = [
96+ "🚫 Merge Conflicts",
9297 "β›” Don't Merge",
9398 "πŸ”¨ Needs Work",
9499 "πŸ”¬ Needs Testing",
@@ -116,9 +121,9 @@ jobs:
116121 console.log("No merge-blocking labels found.");
117122 }
118123
119124 prwrite-auto-comments:
120125 name: Post PR Comments Based on Labels
121126 needs: [check-merge-conflicts, prlabel-sizeby-labelersize, label-releaseby-prsbranches, apply-filelabel-basedby-labelsfiles]
122127 runs-on: ubuntu-latest
123128
124129 steps:
@@ -162,7 +167,8 @@ jobs:
162167 ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique')
163168 echo "final_issues=$ISSUES" >> $GITHUB_ENV
164169
165170 - name: Comment and Label Linked Issues
171+ id: label_linked_issues
166172 env:
167173 GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
168174 run: |