mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
PR workflow, add labels based on files/branch name
- Add PR labels based on changed files - Add PR labels based on branch names
This commit is contained in:
29
.github/pr-auto-labels,yml
vendored
29
.github/pr-auto-labels,yml
vendored
@@ -1,29 +0,0 @@
|
|||||||
🏭 Backend Changes:
|
|
||||||
- "src/**"
|
|
||||||
- "server.js"
|
|
||||||
- "plugins.js"
|
|
||||||
- "recover.js"
|
|
||||||
- "webpack.config.js"
|
|
||||||
- "Start.bat"
|
|
||||||
- "start.sh"
|
|
||||||
- "UpdateAndStart.bat"
|
|
||||||
- "UpdateForkAndStart.bat"
|
|
||||||
|
|
||||||
🛠️ Build Changes:
|
|
||||||
- ".github/workflows/**"
|
|
||||||
- "docker/**"
|
|
||||||
- ".dockerignore"
|
|
||||||
- "Dockerfile"
|
|
||||||
- "webpack.config.js"
|
|
||||||
|
|
||||||
🌐 Language:
|
|
||||||
- "public/locales/**"
|
|
||||||
|
|
||||||
📥 Dependencies:
|
|
||||||
- "public/lib/**" # Every frontend lib counts as a dependency as well
|
|
||||||
- "package.json"
|
|
||||||
- "package-lock.json"
|
|
||||||
- "tests/package.json"
|
|
||||||
- "tests/package-lock.json"
|
|
||||||
- "src/electron/package.json"
|
|
||||||
- "src/electron/package-lock.json"
|
|
77
.github/pr-auto-labels-by-branch.yml
vendored
Normal file
77
.github/pr-auto-labels-by-branch.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
####################################
|
||||||
|
# Label PRs against 'release' #
|
||||||
|
####################################
|
||||||
|
❗ Against Release Branch:
|
||||||
|
- base-branch: 'release'
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Labels based on PR branch name #
|
||||||
|
####################################
|
||||||
|
🦋 Bug Fix:
|
||||||
|
- head-branch: ['^fix[/-]', '\bfixes\b']
|
||||||
|
|
||||||
|
🚑 Hot Fix:
|
||||||
|
- head-branch: ['^hotfix[/-]']
|
||||||
|
|
||||||
|
✨ New Feature:
|
||||||
|
- head-branch: ['^feat(ure)?[/-].*?\badd', '^add-']
|
||||||
|
|
||||||
|
✨ Feature Changes:
|
||||||
|
- head-branch: ['^feat(ure)?[/-](?!.*\badd\b)', '\bchanges?\b']
|
||||||
|
|
||||||
|
🤖 API / Model:
|
||||||
|
- head-branch: ['\bapi\b', '\bmodels?\b']
|
||||||
|
|
||||||
|
🏭 Backend Changes:
|
||||||
|
- head-branch: ['\bbackend\b', '\bendpoints?\b']
|
||||||
|
|
||||||
|
🐋 Docker:
|
||||||
|
- head-branch: ['\bdocker\b']
|
||||||
|
|
||||||
|
➕ Extension:
|
||||||
|
- head-branch: ['\bextension\b', '\bext\b']
|
||||||
|
|
||||||
|
🦊 Firefox:
|
||||||
|
- head-branch: ['\bfirefox\b']
|
||||||
|
|
||||||
|
🖼️ Image Gen:
|
||||||
|
- head-branch: ['\bimage-gen\b']
|
||||||
|
|
||||||
|
🌐 Language:
|
||||||
|
- head-branch: ['\btranslations?\b', '\blanguages?\b']
|
||||||
|
|
||||||
|
🐧 Linux:
|
||||||
|
- head-branch: ['\blinux\b']
|
||||||
|
|
||||||
|
🧩 Macros:
|
||||||
|
- head-branch: ['\bmacros?\b']
|
||||||
|
|
||||||
|
📱 Mobile:
|
||||||
|
- head-branch: ['\bmobile\b', '\bios\b', '\bandroid\b']
|
||||||
|
|
||||||
|
🚄 Performance:
|
||||||
|
- head-branch: ['\bperformance\b']
|
||||||
|
|
||||||
|
⚙️ Preset:
|
||||||
|
- head-branch: ['\bpresets?\b']
|
||||||
|
|
||||||
|
📜 Prompt:
|
||||||
|
- head-branch: ['\bprompt\b']
|
||||||
|
|
||||||
|
🚚 Refactor:
|
||||||
|
- head-branch: ['\brefactor(s|ed)?\b']
|
||||||
|
|
||||||
|
📜 STscript:
|
||||||
|
- head-branch: ['\bstscript\b', '\bslash-commands\b']
|
||||||
|
|
||||||
|
🏷️ Tags / Folders:
|
||||||
|
- head-branch: ['\btags\b']
|
||||||
|
|
||||||
|
🎙️ TTS / Voice:
|
||||||
|
- head-branch: ['\btts\b', '\bvoice\b']
|
||||||
|
|
||||||
|
🌟 UX:
|
||||||
|
- head-branch: ['\bux\b']
|
||||||
|
|
||||||
|
🗺️ World Info:
|
||||||
|
- head-branch: ['\bworld-info\b', '\bwi\b']
|
40
.github/pr-auto-labels-by-files.yml
vendored
Normal file
40
.github/pr-auto-labels-by-files.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
####################################
|
||||||
|
# Labels based on changed files #
|
||||||
|
####################################
|
||||||
|
🏭 Backend Changes:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- "src/**"
|
||||||
|
- "server.js"
|
||||||
|
- "plugins.js"
|
||||||
|
- "recover.js"
|
||||||
|
- "webpack.config.js"
|
||||||
|
- "Start.bat"
|
||||||
|
- "start.sh"
|
||||||
|
- "UpdateAndStart.bat"
|
||||||
|
- "UpdateForkAndStart.bat"
|
||||||
|
|
||||||
|
🛠️ Build Changes:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- ".github/workflows/**"
|
||||||
|
- "docker/**"
|
||||||
|
- ".dockerignore"
|
||||||
|
- "Dockerfile"
|
||||||
|
- "webpack.config.js"
|
||||||
|
|
||||||
|
🌐 Language:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- "public/locales/**"
|
||||||
|
|
||||||
|
📥 Dependencies:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- "public/lib/**" # Every frontend lib counts as a dependency as well
|
||||||
|
- "package.json"
|
||||||
|
- "package-lock.json"
|
||||||
|
- "tests/package.json"
|
||||||
|
- "tests/package-lock.json"
|
||||||
|
- "src/electron/package.json"
|
||||||
|
- "src/electron/package-lock.json"
|
34
.github/workflows/pr-auto-manager.yml
vendored
34
.github/workflows/pr-auto-manager.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
commentOnDirty: >
|
commentOnDirty: >
|
||||||
⚠️ This PR has conflicts that need to be resolved before it can be merged.
|
⚠️ This PR has conflicts that need to be resolved before it can be merged.
|
||||||
|
|
||||||
pr-size-labeler:
|
label-by-size:
|
||||||
name: Apply Label for PR Size
|
name: Apply Label for PR Size
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -50,19 +50,22 @@ jobs:
|
|||||||
"package-lock.json"
|
"package-lock.json"
|
||||||
"public/lib/*"
|
"public/lib/*"
|
||||||
|
|
||||||
label-release-prs:
|
label-by-branches:
|
||||||
name: Label PRs Targeting Release Branch
|
name: Apply Labels Based on Branch Name and Target Branch
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Only label once when PR is created or branches are changed, to allow manual label removal
|
||||||
|
if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head))
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Label PRs Targeting Release Branch
|
- name: Apply Labels Based on Branch Name and Target Branch
|
||||||
if: github.base_ref == 'release'
|
# Pull Request Labeler
|
||||||
run: |
|
# https://github.com/marketplace/actions/labeler
|
||||||
gh pr edit ${{ github.event.pull_request.number }} --add-label "❗ Against Release Branch"
|
uses: actions/labeler@v5
|
||||||
env:
|
with:
|
||||||
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
configuration-path: .github/pr-auto-labels-by-branch.yml
|
||||||
|
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
apply-file-based-labels:
|
label-by-files:
|
||||||
name: Apply Labels Based on Changed Files
|
name: Apply Labels Based on Changed Files
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -72,11 +75,12 @@ jobs:
|
|||||||
# https://github.com/marketplace/actions/labeler
|
# https://github.com/marketplace/actions/labeler
|
||||||
uses: actions/labeler@v5
|
uses: actions/labeler@v5
|
||||||
with:
|
with:
|
||||||
|
configuration-path: .github/pr-auto-labels-by-files.yml
|
||||||
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
check-merge-blocking-labels:
|
check-merge-blocking-labels:
|
||||||
name: Check Merge Blocking Labels
|
name: Check Merge Blocking Labels
|
||||||
needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]
|
needs: [check-merge-conflicts, label-by-size, label-by-branches, label-by-files]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -89,6 +93,7 @@ jobs:
|
|||||||
script: |
|
script: |
|
||||||
const prLabels = context.payload.pull_request.labels.map(label => label.name);
|
const prLabels = context.payload.pull_request.labels.map(label => label.name);
|
||||||
const blockingLabels = [
|
const blockingLabels = [
|
||||||
|
"🚫 Merge Conflicts",
|
||||||
"⛔ Don't Merge",
|
"⛔ Don't Merge",
|
||||||
"🔨 Needs Work",
|
"🔨 Needs Work",
|
||||||
"🔬 Needs Testing",
|
"🔬 Needs Testing",
|
||||||
@@ -116,9 +121,9 @@ jobs:
|
|||||||
console.log("No merge-blocking labels found.");
|
console.log("No merge-blocking labels found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
pr-auto-comments:
|
write-auto-comments:
|
||||||
name: Post PR Comments Based on Labels
|
name: Post PR Comments Based on Labels
|
||||||
needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]
|
needs: [check-merge-conflicts, label-by-size, label-by-branches, label-by-files]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -162,7 +167,8 @@ jobs:
|
|||||||
ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique')
|
ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique')
|
||||||
echo "final_issues=$ISSUES" >> $GITHUB_ENV
|
echo "final_issues=$ISSUES" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Comment and Label Issues
|
- name: Label Linked Issues
|
||||||
|
id: label_linked_issues
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
Reference in New Issue
Block a user