From 29f8943d774abde130857a24145dde777a41544c Mon Sep 17 00:00:00 2001 From: Phil Connor Date: Mon, 25 May 2026 03:36:51 +0200 Subject: [PATCH] Add CI pipeline: ShellCheck + PowerShell lint Amp-Thread-ID: https://ampcode.com/threads/T-019e5bf0-feea-727d-9e3d-15c2ecf47812 Co-authored-by: Amp --- .gitea/workflows/lint.yaml | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .gitea/workflows/lint.yaml diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml new file mode 100644 index 0000000..3b16c8b --- /dev/null +++ b/.gitea/workflows/lint.yaml @@ -0,0 +1,61 @@ +name: Lint Scripts +on: + push: + branches: [main] + pull_request: + +jobs: + shellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: ShellCheck — all .sh files + run: | + echo "::group::Running ShellCheck" + failed=0 + for f in *.sh; do + [ -f "$f" ] || continue + if ! shellcheck -S error "$f" 2>&1; then + failed=1 + fi + done + echo "::endgroup::" + if [ "$failed" -eq 1 ]; then + echo "::error::ShellCheck found errors (severity: error)" + exit 1 + fi + echo "All shell scripts passed ShellCheck (error severity)" + + powershell-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: PowerShell syntax check + run: | + echo "::group::PowerShell syntax check" + failed=0 + for f in *.ps1; do + [ -f "$f" ] || continue + if ! pwsh -NoProfile -Command " + \$null = [System.Management.Automation.Language.Parser]::ParseFile( + (Resolve-Path '$f'), + [ref]\$null, + [ref]\$errors + ) + if (\$errors.Count -gt 0) { + \$errors | ForEach-Object { Write-Error \$_.Message } + exit 1 + } + " 2>&1; then + echo "FAIL: $f" + failed=1 + fi + done + echo "::endgroup::" + if [ "$failed" -eq 1 ]; then + echo "::error::PowerShell syntax errors found" + exit 1 + fi + echo "All PowerShell scripts passed syntax check"