mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-01-29 17:11:15 -05:00
GIT: workflows - auto close no template removal, docs
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
67
.github/workflows/enforce-template.yml
vendored
67
.github/workflows/enforce-template.yml
vendored
@@ -1,67 +0,0 @@
|
||||
name: Enforce Issue Templates
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
enforce-template:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check for template usage
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const body = (context.payload.issue?.body || "").toLowerCase();
|
||||
const title = (context.payload.issue?.title || "").toLowerCase();
|
||||
|
||||
// Manual runs don't have an issue context
|
||||
if (!context.payload.issue) {
|
||||
console.log("No issue context (manual run) – nothing to enforce.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Check for template marker
|
||||
const usedTemplate = body.includes('netalertx_template');
|
||||
|
||||
// 2. Security bypass
|
||||
const isSecurity =
|
||||
title.includes('security') ||
|
||||
title.includes('vulnerability');
|
||||
|
||||
if (!usedTemplate && !isSecurity) {
|
||||
const warningLabel = 'missing-template 📋';
|
||||
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: [warningLabel]
|
||||
});
|
||||
|
||||
const commentMessage = `
|
||||
Hi there! 👋 Thanks for reaching out.
|
||||
|
||||
To help the maintainers triage issues effectively, we **enforce the use of issue templates**.
|
||||
|
||||
Please [open a new issue here](https://github.com/${context.repo.owner}/${context.repo.repo}/issues/new/choose)
|
||||
and select the appropriate template.
|
||||
|
||||
Thank you! 🙏
|
||||
`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: commentMessage
|
||||
});
|
||||
|
||||
// Intentionally NOT closing issues in manual mode
|
||||
console.log("Issue missing template – labeled and commented.");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Template detected or security issue – no action taken.");
|
||||
@@ -44,7 +44,8 @@ ARPSCAN_DURATION=30
|
||||
|
||||
Enable the `ICMP` scan plugin to complement ARP detection. ICMP is often more reliable for detecting active hosts, especially when ARP fails.
|
||||
|
||||
> [!IMPORTANT] If using AdGuard/Pi-hole: If devices still show offline after enabling ICMP, temporarily disable your content blocker. If the issue disappears, whitelist the NetAlertX host IP in your blocker's settings to prevent pings from being dropped.
|
||||
> [!IMPORTANT]
|
||||
> If using AdGuard/Pi-hole: If devices still show offline after enabling ICMP, temporarily disable your content blocker. If the issue disappears, whitelist the NetAlertX host IP in your blocker's settings to prevent pings from being dropped.
|
||||
|
||||
### ✅ Use Multiple Detection Methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user