validate-licenses.yml 922 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. name: Validate Plugin Licenses
  2. on:
  3. pull_request:
  4. paths:
  5. - 'plugins/**'
  6. push:
  7. branches: [main]
  8. paths:
  9. - 'plugins/**'
  10. permissions:
  11. contents: read
  12. jobs:
  13. validate-licenses:
  14. runs-on: ubuntu-latest
  15. steps:
  16. - uses: actions/checkout@v4
  17. - name: Check every plugin has an Apache 2.0 LICENSE file
  18. run: |
  19. set -euo pipefail
  20. missing=()
  21. for plugin_dir in plugins/*/; do
  22. plugin="${plugin_dir%/}"
  23. if [[ ! -f "$plugin/LICENSE" ]]; then
  24. missing+=("$plugin")
  25. fi
  26. done
  27. if [[ "${#missing[@]}" -gt 0 ]]; then
  28. echo "::error::The following plugins are missing a LICENSE file:"
  29. for p in "${missing[@]}"; do
  30. echo " - $p"
  31. done
  32. exit 1
  33. fi
  34. echo "All $(ls -d plugins/*/ | wc -l) plugins have a LICENSE file."