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 | π Backend Changes: | 4 | π Backend Changes: |
| 2 | - "src/**" | 5 | - changed-files: |
| 3 | - "server.js" | 6 | - any-glob-to-any-file: |
| 4 | - "plugins.js" | 7 | - "src/**" |
| 5 | - "recover.js" | 8 | - "server.js" |
| 6 | - "webpack.config.js" | 9 | - "plugins.js" |
| 7 | - "Start.bat" | 10 | - "recover.js" |
| 8 | - "start.sh" | 11 | - "webpack.config.js" |
| 9 | - "UpdateAndStart.bat" | 12 | - "Start.bat" |
| 10 | - "UpdateForkAndStart.bat" | 13 | - "start.sh" |
| 14 | - "UpdateAndStart.bat" | ||
| 15 | - "UpdateForkAndStart.bat" | ||
| 11 | 16 | ||
| 12 | π οΈ Build Changes: | 17 | π οΈ Build Changes: |
| 13 | - ".github/workflows/**" | 18 | - changed-files: |
| 14 | - "docker/**" | 19 | - any-glob-to-any-file: |
| 15 | - ".dockerignore" | 20 | - ".github/workflows/**" |
| 16 | - "Dockerfile" | 21 | - "docker/**" |
| 17 | - "webpack.config.js" | 22 | - ".dockerignore" |
| 23 | - "Dockerfile" | ||
| 24 | - "webpack.config.js" | ||
| 18 | 25 | ||
| 19 | π Language: | 26 | π Language: |
| 20 | - "public/locales/**" | 27 | - changed-files: |
| 28 | - any-glob-to-any-file: | ||
| 29 | - "public/locales/**" | ||
| 21 | 30 | ||
| 22 | π₯ Dependencies: | 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 | - "tests/package.json" | 35 | - "package.json" |
| 27 | - "tests/package-lock.json" | 36 | - "package-lock.json" |
| 28 | - "src/electron/package.json" | 37 | - "tests/package.json" |
| 29 | - "src/electron/package-lock.json" | 38 | - "tests/package-lock.json" |
| 39 | - "src/electron/package.json" | ||
| 40 | - "src/electron/package-lock.json" | ||
| @@ -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. |
| 22 | 22 | ||
| 23 | pr-size-labeler: | 23 | label-by-size: |
| 24 | name: Apply Label for PR Size | 24 | name: Apply Label for PR Size |
| 25 | runs-on: ubuntu-latest | 25 | runs-on: ubuntu-latest |
| 26 | 26 | ||
| @@ -50,19 +50,22 @@ jobs: | |||
| 50 | "package-lock.json" | 50 | "package-lock.json" |
| 51 | "public/lib/*" | 51 | "public/lib/*" |
| 52 | 52 | ||
| 53 | label-release-prs: | 53 | label-by-branches: |
| 54 | name: Label PRs Targeting Release Branch | 54 | name: Apply Labels Based on Branch Name and Target Branch |
| 55 | runs-on: ubuntu-latest | 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 | steps: | 59 | steps: |
| 58 | - name: Label PRs Targeting Release Branch | 60 | - 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 }} | ||
| 64 | 67 | ||
| 65 | apply-file-based-labels: | 68 | label-by-files: |
| 66 | name: Apply Labels Based on Changed Files | 69 | name: Apply Labels Based on Changed Files |
| 67 | runs-on: ubuntu-latest | 70 | runs-on: ubuntu-latest |
| 68 | 71 | ||
| @@ -72,11 +75,12 @@ jobs: | |||
| 72 | # https://github.com/marketplace/actions/labeler | 75 | # https://github.com/marketplace/actions/labeler |
| 73 | uses: actions/labeler@v5 | 76 | 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 }} |
| 76 | 80 | ||
| 77 | check-merge-blocking-labels: | 81 | check-merge-blocking-labels: |
| 78 | name: Check Merge Blocking Labels | 82 | 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-latest | 84 | runs-on: ubuntu-latest |
| 81 | 85 | ||
| 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 | } |
| 118 | 123 | ||
| 119 | pr-auto-comments: | 124 | write-auto-comments: |
| 120 | name: Post PR Comments Based on Labels | 125 | 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-latest | 127 | runs-on: ubuntu-latest |
| 123 | 128 | ||
| 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_ENV | 168 | echo "final_issues=$ISSUES" >> $GITHUB_ENV |
| 164 | 169 | ||
| 165 | - name: Comment and Label Issues | 170 | - 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: | |