check-vendor.yml 1.2 KB

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