feat: endpoint to trigger directory scans from external tools #847
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint | |
| on: | |
| pull_request: | |
| env: | |
| NODE_VERSION: "22.18.0" | |
| jobs: | |
| web: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Install frontend dependencies | |
| working-directory: web | |
| run: pnpm install | |
| - name: Lint frontend | |
| working-directory: web | |
| run: | | |
| webfiles=$({ git diff --name-only --diff-filter=d "origin/${{ github.base_ref }}"...HEAD -- 'web/'; } | sort -u | sed 's|^web/||' | grep -E '\.(ts|tsx|js|jsx)$' || true) | |
| if [ -n "$webfiles" ]; then echo "$webfiles" | xargs pnpm eslint; else echo "No frontend files to lint."; fi | |
| backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| - name: Check gofix drift on changed Go files | |
| run: | | |
| gofiles=$({ git diff --name-only --diff-filter=d "origin/${{ github.base_ref }}"...HEAD; } | sort -u | grep '\.go$' || true) | |
| if [ -z "$gofiles" ]; then | |
| echo "No backend files to check with go fix." | |
| exit 0 | |
| fi | |
| gopkgs=$(printf '%s\n' "$gofiles" | xargs -n 1 dirname | sort -u) | |
| tmp=$(mktemp) | |
| failed=0 | |
| while IFS= read -r pkg; do | |
| [ -n "$pkg" ] || continue | |
| pkg_err=$(mktemp) | |
| if ! go fix -diff "./$pkg" >> "$tmp" 2> "$pkg_err"; then | |
| if grep -Eq 'fix: .* skipped \(e\.g\. due to conflicts\)' "$pkg_err"; then | |
| echo "go fix reported skipped fixes for ./$pkg; continuing." | |
| else | |
| echo "go fix failed for ./$pkg:" | |
| cat "$pkg_err" | |
| failed=1 | |
| fi | |
| fi | |
| rm -f "$pkg_err" | |
| done <<< "$gopkgs" | |
| if [ "$failed" -ne 0 ]; then | |
| rm -f "$tmp" | |
| exit 1 | |
| fi | |
| if [ -s "$tmp" ]; then | |
| echo "go fix changes required for changed Go files:" | |
| cat "$tmp" | |
| rm -f "$tmp" | |
| exit 1 | |
| fi | |
| rm -f "$tmp" | |
| echo "go fix check clean." | |
| - name: Lint backend | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.11.1 | |
| only-new-issues: true |