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####################################
1🏭 Backend Changes:4🏭 Backend Changes:
5- changed-files:
6 - any-glob-to-any-file:
2 - "src/**"7 - "src/**"
3 - "server.js"8 - "server.js"
4 - "plugins.js"9 - "plugins.js"
@@ -10,6 +15,8 @@
10 - "UpdateForkAndStart.bat"15 - "UpdateForkAndStart.bat"
1116
12πŸ› οΈ Build Changes:17πŸ› οΈ Build Changes:
18- changed-files:
19 - any-glob-to-any-file:
13 - ".github/workflows/**"20 - ".github/workflows/**"
14 - "docker/**"21 - "docker/**"
15 - ".dockerignore"22 - ".dockerignore"
@@ -17,9 +24,13 @@
17 - "webpack.config.js"24 - "webpack.config.js"
1825
19🌐 Language:26🌐 Language:
27- changed-files:
28 - any-glob-to-any-file:
20 - "public/locales/**"29 - "public/locales/**"
2130
22πŸ“₯ Dependencies:31πŸ“₯ Dependencies:
32- changed-files:
33 - any-glob-to-any-file:
23 - "public/lib/**" # Every frontend lib counts as a dependency as well34 - "public/lib/**" # Every frontend lib counts as a dependency as well
24 - "package.json"35 - "package.json"
25 - "package-lock.json"36 - "package-lock.json"
.github/workflows/pr-auto-manager.yml+20 -14
@@ -20,7 +20,7 @@ jobs:
20 commentOnDirty: >20 commentOnDirty: >
21 ⚠️ This PR has conflicts that need to be resolved before it can be merged.21 ⚠️ This PR has conflicts that need to be resolved before it can be merged.
2222
23 pr-size-labeler:23 label-by-size:
24 name: Apply Label for PR Size24 name: Apply Label for PR Size
25 runs-on: ubuntu-latest25 runs-on: ubuntu-latest
2626
@@ -50,19 +50,22 @@ jobs:
50 "package-lock.json"50 "package-lock.json"
51 "public/lib/*"51 "public/lib/*"
5252
53 label-release-prs:53 label-by-branches:
54 name: Label PRs Targeting Release Branch54 name: Apply Labels Based on Branch Name and Target Branch
55 runs-on: ubuntu-latest55 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
57 steps:59 steps:
58 - name: Label PRs Targeting Release Branch60 - name: Apply Labels Based on 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
62 env:64 with:
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
65 apply-file-based-labels:68 label-by-files:
66 name: Apply Labels Based on Changed Files69 name: Apply Labels Based on Changed Files
67 runs-on: ubuntu-latest70 runs-on: ubuntu-latest
6871
@@ -72,11 +75,12 @@ jobs:
72 # https://github.com/marketplace/actions/labeler75 # https://github.com/marketplace/actions/labeler
73 uses: actions/labeler@v576 uses: actions/labeler@v5
74 with:77 with:
78 configuration-path: .github/pr-auto-labels-by-files.yml
75 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}79 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
7680
77 check-merge-blocking-labels:81 check-merge-blocking-labels:
78 name: Check Merge Blocking Labels82 name: Check Merge Blocking Labels
79 needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]83 needs: [check-merge-conflicts, label-by-size, label-by-branches, label-by-files]
80 runs-on: ubuntu-latest84 runs-on: ubuntu-latest
8185
82 steps:86 steps:
@@ -89,6 +93,7 @@ jobs:
89 script: |93 script: |
90 const prLabels = context.payload.pull_request.labels.map(label => label.name);94 const prLabels = context.payload.pull_request.labels.map(label => label.name);
91 const blockingLabels = [95 const blockingLabels = [
96 "🚫 Merge Conflicts",
92 "β›” Don't Merge",97 "β›” Don't Merge",
93 "πŸ”¨ Needs Work",98 "πŸ”¨ Needs Work",
94 "πŸ”¬ Needs Testing",99 "πŸ”¬ Needs Testing",
@@ -116,9 +121,9 @@ jobs:
116 console.log("No merge-blocking labels found.");121 console.log("No merge-blocking labels found.");
117 }122 }
118123
119 pr-auto-comments:124 write-auto-comments:
120 name: Post PR Comments Based on Labels125 name: Post PR Comments Based on Labels
121 needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]126 needs: [check-merge-conflicts, label-by-size, label-by-branches, label-by-files]
122 runs-on: ubuntu-latest127 runs-on: ubuntu-latest
123128
124 steps:129 steps:
@@ -162,7 +167,8 @@ jobs:
162 ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique')167 ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique')
163 echo "final_issues=$ISSUES" >> $GITHUB_ENV168 echo "final_issues=$ISSUES" >> $GITHUB_ENV
164169
165 - name: Comment and Label Issues170 - name: Label Linked Issues
171 id: label_linked_issues
166 env:172 env:
167 GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}173 GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
168 run: |174 run: |