ci: add lint workflow, shellcheck fixes, and CI failure hookshot alert
- .gitea/workflows/lint.yml: new workflow running shellcheck on .sh files
and eslint on hookshot/ JS transform scripts
- hookshot/.eslintrc.json: declare data/result as hookshot globals
- hookshot/ci-alert.js: new Matrix hookshot transform for CI failure alerts
- hookshot/deploy.sh: fix SC2155 (split local/assign), SC2034 (remove unused var)
- systemd/livekit-clear-port.sh: fix SC2148 (invalid shebang escape)
- cinny/dev-update.sh: fix SC2115 (use ${WEB_ROOT:?} to guard rm -rf)
- deploy/lxc151-hookshot.sh: add shellcheck source=/dev/null for sourced file
- .gitignore: ignore node_modules/
- package.json + package-lock.json: eslint@8 dev dependency
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["**"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
shell-lint:
|
||||||
|
name: Shell (shellcheck)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install shellcheck
|
||||||
|
run: apt-get update -qq && apt-get install -y -qq shellcheck
|
||||||
|
|
||||||
|
- name: Run shellcheck
|
||||||
|
run: find . -name "*.sh" -exec shellcheck {} +
|
||||||
|
|
||||||
|
js-lint:
|
||||||
|
name: JS (eslint)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install ESLint
|
||||||
|
run: npm install --save-dev eslint@8
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: npx eslint --ext .js hookshot/
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
.env
|
.env
|
||||||
|
node_modules/
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ if [ ! -f "$BUILD_DIR/index.html" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Deploy only now that we know the build succeeded
|
# Deploy only now that we know the build succeeded
|
||||||
rm -rf "$WEB_ROOT"/*
|
rm -rf "${WEB_ROOT:?}"/*
|
||||||
cp -r "$BUILD_DIR"/* "$WEB_ROOT/"
|
cp -r "$BUILD_DIR"/* "$WEB_ROOT/"
|
||||||
|
|
||||||
# Restore config
|
# Restore config
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ echo "=== $(date) === LXC151 deploy triggered ==="
|
|||||||
|
|
||||||
# Load env (MATRIX_TOKEN, MATRIX_SERVER, MATRIX_ROOM)
|
# Load env (MATRIX_TOKEN, MATRIX_SERVER, MATRIX_ROOM)
|
||||||
if [ -f "$ENV_FILE" ]; then
|
if [ -f "$ENV_FILE" ]; then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$ENV_FILE"
|
source "$ENV_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"env": { "es2021": true },
|
||||||
|
"parserOptions": { "ecmaVersion": 2021 },
|
||||||
|
"globals": {
|
||||||
|
"data": "readonly",
|
||||||
|
"result": "writable"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-unused-vars": "warn",
|
||||||
|
"no-undef": "error",
|
||||||
|
"semi": ["error", "always"],
|
||||||
|
"eqeqeq": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// Gitea Actions CI failure alert
|
||||||
|
// Receives: { text: "CI FAILED: repo @ branch — url" }
|
||||||
|
// Posted by the notify-failure job in each repo's lint.yml
|
||||||
|
var msg = data.text || data.body || '';
|
||||||
|
var lines = ['🔴 ' + msg];
|
||||||
|
var htmlParts = ['🔴 <b>CI Failure</b><br>' + msg.replace(/—\s*(https?:\/\/\S+)/, '— <a href="$1">View Run</a>')];
|
||||||
|
result = { version: 'v2', plain: lines.join('\n'), html: htmlParts.join('<br>'), msgtype: 'm.notice' };
|
||||||
+8
-5
@@ -23,13 +23,16 @@ DIR="$(cd "$(dirname "$0")" && pwd)"
|
|||||||
|
|
||||||
deploy_hook() {
|
deploy_hook() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
local filename="$(basename "$file" .js)"
|
local filename
|
||||||
|
filename="$(basename "$file" .js)"
|
||||||
# Capitalize first letter of each hyphen-separated word, preserving hyphens
|
# Capitalize first letter of each hyphen-separated word, preserving hyphens
|
||||||
# e.g. proxmox -> Proxmox, uptime-kuma -> Uptime-Kuma, tinker-tickets -> Tinker-Tickets
|
# e.g. proxmox -> Proxmox, uptime-kuma -> Uptime-Kuma, tinker-tickets -> Tinker-Tickets
|
||||||
local state_key="$(python3 -c "import sys; s='$filename'; print('-'.join(w.capitalize() for w in s.split('-')))")"
|
local state_key
|
||||||
local fn="$(cat "$file")"
|
state_key="$(python3 -c "import sys; s='$filename'; print('-'.join(w.capitalize() for w in s.split('-')))")"
|
||||||
local encoded_room="$(python3 -c "import urllib.parse; print(urllib.parse.quote('$MATRIX_ROOM'))")"
|
local encoded_room
|
||||||
local encoded_key="$(python3 -c "import urllib.parse; print(urllib.parse.quote('$state_key'))")"
|
encoded_room="$(python3 -c "import urllib.parse; print(urllib.parse.quote('$MATRIX_ROOM'))")"
|
||||||
|
local encoded_key
|
||||||
|
encoded_key="$(python3 -c "import urllib.parse; print(urllib.parse.quote('$state_key'))")"
|
||||||
|
|
||||||
local response
|
local response
|
||||||
response=$(curl -sf -X PUT \
|
response=$(curl -sf -X PUT \
|
||||||
|
|||||||
Generated
+1140
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^8.57.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#\!/bin/bash
|
#!/bin/bash
|
||||||
pkill -x livekit-server 2>/dev/null && sleep 1
|
pkill -x livekit-server 2>/dev/null && sleep 1
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user