Files
NetAlertX/.github/workflows/label-issues.yml
2026-01-27 12:52:21 +11:00

53 lines
1.5 KiB
YAML
Executable File

name: Label Issues by Installation Type
on:
issues:
types: [opened]
permissions:
issues: write
jobs:
add-label:
runs-on: ubuntu-latest
steps:
- name: Get issue content
uses: actions/github-script@v7
with:
script: |
const body = (context.payload.issue.body || "").toLowerCase();
// --- Check for template marker ---
const hasTemplate = body.includes('netalertx_template');
if (!hasTemplate) {
console.log("No template marker found, skipping labeling.");
return; // skip labeling
}
// --- Proceed with normal labeling ---
let labelsToAdd = [];
if (body.includes('bare-metal') || body.includes('proxmox')) {
labelsToAdd.push('bare-metal ❗');
}
if (body.includes('home assistant')) {
labelsToAdd.push('Home Assistant 🏠');
}
if (body.includes('production (netalertx)') || body.includes('dev (netalertx-dev)')) {
labelsToAdd.push('Docker 🐋');
}
if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labelsToAdd
});
console.log(`Added labels: ${labelsToAdd.join(", ")}`);
}