PR workflow, add labels based on files/branch name - Add PR labels based on changed files - Add PR labels based on branch names
| @@ -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'] | |
| @@ -1,29 +1,40 @@ | ||
| 1 | +#################################### | |
| 2 | +# Labels based on changed files # | |
| 3 | +#################################### | |
| 1 | 4 | π Backend Changes: |
| 2 | - - "src/**" | |
| 5 | +- changed-files: | |
| 3 | - - "server.js" | |
| 6 | + - any-glob-to-any-file: | |
| 4 | - - "plugins.js" | |
| 7 | + - "src/**" | |
| 5 | 8 | - "recoverserver.js" |
| 6 | 9 | - "webpack.configplugins.js" |
| 7 | 10 | - "Startrecover.batjs" |
| 8 | 11 | - "startwebpack.shconfig.js" |
| 9 | 12 | - "UpdateAndStartStart.bat" |
| 10 | 13 | - "UpdateForkAndStartstart.batsh" |
| 14 | + - "UpdateAndStart.bat" | |
| 15 | + - "UpdateForkAndStart.bat" | |
| 11 | 16 | |
| 12 | 17 | π οΈ Build Changes: |
| 13 | - - ".github/workflows/**" | |
| 18 | +- changed-files: | |
| 14 | - - "docker/**" | |
| 19 | + - any-glob-to-any-file: | |
| 15 | 20 | - ".dockerignoregithub/workflows/**" |
| 16 | 21 | - "Dockerfiledocker/**" |
| 17 | 22 | - "webpack.config.jsdockerignore" |
| 23 | + - "Dockerfile" | |
| 24 | + - "webpack.config.js" | |
| 18 | 25 | |
| 19 | 26 | π Language: |
| 20 | - - "public/locales/**" | |
| 27 | +- changed-files: | |
| 28 | + - any-glob-to-any-file: | |
| 29 | + - "public/locales/**" | |
| 21 | 30 | |
| 22 | 31 | π₯ Dependencies: |
| 23 | - - "public/lib/**" # Every frontend lib counts as a dependency as well | |
| 32 | +- changed-files: | |
| 24 | - - "package.json" | |
| 33 | + - any-glob-to-any-file: | |
| 25 | - - "package-lock.json" | |
| 34 | + - "public/lib/**" # Every frontend lib counts as a dependency as well | |
| 26 | 35 | - "tests/package.json" |
| 27 | 36 | - "tests/package-lock.json" |
| 28 | 37 | - "src/electrontests/package.json" |
| 29 | 38 | - "src/electrontests/package-lock.json" |
| 39 | + - "src/electron/package.json" | |
| 40 | + - "src/electron/package-lock.json" | |
| @@ -20,7 +20,7 @@ jobs: | ||
| 20 | 20 | commentOnDirty: > |
| 21 | 21 | β οΈ This PR has conflicts that need to be resolved before it can be merged. |
| 22 | 22 | |
| 23 | 23 | prlabel-sizeby-labelersize: |
| 24 | 24 | name: Apply Label for PR Size |
| 25 | 25 | runs-on: ubuntu-latest |
| 26 | 26 | |
| @@ -50,19 +50,22 @@ jobs: | ||
| 50 | 50 | "package-lock.json" |
| 51 | 51 | "public/lib/*" |
| 52 | 52 | |
| 53 | 53 | label-releaseby-prsbranches: |
| 54 | 54 | name: LabelApply PRsLabels TargetingBased Releaseon Branch Name and Target Branch |
| 55 | 55 | 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)) | |
| 56 | 58 | |
| 57 | 59 | steps: |
| 58 | 60 | - 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 | |
| 62 | 64 | 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 }} | |
| 64 | 67 | |
| 65 | 68 | apply-filelabel-basedby-labelsfiles: |
| 66 | 69 | name: Apply Labels Based on Changed Files |
| 67 | 70 | runs-on: ubuntu-latest |
| 68 | 71 | |
| @@ -72,11 +75,12 @@ jobs: | ||
| 72 | 75 | # https://github.com/marketplace/actions/labeler |
| 73 | 76 | uses: actions/labeler@v5 |
| 74 | 77 | with: |
| 78 | + configuration-path: .github/pr-auto-labels-by-files.yml | |
| 75 | 79 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| 76 | 80 | |
| 77 | 81 | check-merge-blocking-labels: |
| 78 | 82 | name: Check Merge Blocking Labels |
| 79 | 83 | needs: [check-merge-conflicts, prlabel-sizeby-labelersize, label-releaseby-prsbranches, apply-filelabel-basedby-labelsfiles] |
| 80 | 84 | runs-on: ubuntu-latest |
| 81 | 85 | |
| 82 | 86 | steps: |
| @@ -89,6 +93,7 @@ jobs: | ||
| 89 | 93 | script: | |
| 90 | 94 | const prLabels = context.payload.pull_request.labels.map(label => label.name); |
| 91 | 95 | const blockingLabels = [ |
| 96 | + "π« Merge Conflicts", | |
| 92 | 97 | "β Don't Merge", |
| 93 | 98 | "π¨ Needs Work", |
| 94 | 99 | "π¬ Needs Testing", |
| @@ -116,9 +121,9 @@ jobs: | ||
| 116 | 121 | console.log("No merge-blocking labels found."); |
| 117 | 122 | } |
| 118 | 123 | |
| 119 | 124 | prwrite-auto-comments: |
| 120 | 125 | name: Post PR Comments Based on Labels |
| 121 | 126 | needs: [check-merge-conflicts, prlabel-sizeby-labelersize, label-releaseby-prsbranches, apply-filelabel-basedby-labelsfiles] |
| 122 | 127 | runs-on: ubuntu-latest |
| 123 | 128 | |
| 124 | 129 | steps: |
| @@ -162,7 +167,8 @@ jobs: | ||
| 162 | 167 | ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique') |
| 163 | 168 | echo "final_issues=$ISSUES" >> $GITHUB_ENV |
| 164 | 169 | |
| 165 | 170 | - name: Comment and Label Linked Issues |
| 171 | + id: label_linked_issues | |
| 166 | 172 | env: |
| 167 | 173 | GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| 168 | 174 | run: | |