fileheader.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: File header
  2. on:
  3. pull_request:
  4. branches: [ develop ]
  5. paths:
  6. - 'CMSIS/Core/**'
  7. - 'CMSIS/Core_A/**'
  8. - 'CMSIS/RTOS2/Include/**'
  9. - 'CMSIS/RTOS2/Source/**'
  10. - 'Device/**'
  11. permissions:
  12. contents: read
  13. pull-requests: write
  14. jobs:
  15. check:
  16. name: Check file header
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Calculate depth
  20. id: depth
  21. run: |
  22. echo ::set-output name=GIT_COMMITS::$((${{ github.event.pull_request.commits }} + 1))
  23. - name: Checkout repository
  24. uses: actions/checkout@v2
  25. with:
  26. ref: ${{ github.event.pull_request.head.sha }}
  27. fetch-depth: ${{ steps.depth.outputs.GIT_COMMITS }}
  28. - id: files
  29. uses: jitterbit/get-changed-files@v1
  30. - name: Check changed files
  31. run: |
  32. echo "GIT_COMMITS=${{ steps.depth.outputs.GIT_COMMITS }}"
  33. echo "::add-matcher::.github/fileheader.json"
  34. RC=0
  35. for changed_file in ${{ steps.files.outputs.added_modified }}; do
  36. ./CMSIS/Utilities/check_header.sh -v -b HEAD~${{ github.event.pull_request.commits }} ${changed_file} || RC=1
  37. done
  38. echo "::remove-matcher owner=fileheader::"
  39. exit $RC