1name: Check vendor
 2
 3on:
 4  workflow_dispatch: # allows manual triggering
 5  push:
 6    branches:
 7      - master
 8    paths: [
 9      'vendor/**',
10      'scripts/sync_vendor.py'
11    ]
12
13  pull_request:
14    types: [opened, synchronize, reopened]
15    paths: [
16      'vendor/**',
17      'scripts/sync_vendor.py'
18    ]
19
20jobs:
21  check-vendor:
22    runs-on: ubuntu-slim
23
24    steps:
25      - name: Checkout
26        uses: actions/checkout@v6
27        with:
28          fetch-depth: 0
29
30      - name: Setup Python
31        uses: actions/setup-python@v6
32        with:
33          python-version: '3.x'
34
35      - name: Run vendor sync
36        run: |
37          set -euo pipefail
38          python3 scripts/sync_vendor.py
39
40      - name: Check for changes
41        run: |
42          set -euo pipefail
43          # detect modified or untracked files
44          changed=$(git status --porcelain --untracked-files=all || true)
45          if [ -n "$changed" ]; then
46            echo "Vendor sync modified files:"
47            echo "$changed" | awk '{ print $2 }' | sed '/^$/d'
48            echo "Failing because vendor files mismatch. Please update scripts/sync_vendor.py"
49            exit 1
50          else
51            echo "Vendor files are up-to-date."
52          fi