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