Include fmt 11.0.2
[openal-soft.git] / fmt-11.0.2 / .github / workflows / lint.yml
blob0792356f64e09317f114f5f2af52a8b6cc2b9099
1 name: lint
3 on:
4   pull_request:
5     paths:
6       - '**.h'
7       - '**.cc'
9 permissions:
10   contents: read
11   pull-requests: write
13 jobs:
14   format_code:
15     runs-on: ubuntu-latest
16     steps:
17     - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
19     - name: Install clang-format
20       uses: aminya/setup-cpp@290824452986e378826155f3379d31bce8753d76 # v0.37.0
21       with:
22         clangformat: 17.0.5
24     - name: Run clang-format
25       id: clang_format
26       run: |
27         find include src -name '*.h' -o -name '*.cc' |  xargs clang-format -i -style=file -fallback-style=none
28         git diff | tee fmt.patch
29         if [ -s fmt.patch ]; then
30           exit 1
31         fi
32     - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
33       if: failure() && steps.clang_format.outcome == 'failure'
34       with:
35         github-token: ${{ secrets.KEY }}
36         script: |
37           const fs = require('fs');
38           const patch = fs.readFileSync('fmt.patch', { encoding: 'utf8' });
39           const comment = `clang-format 17.0.5 found issues in the formatting in your code:
40           <details>
41           <summary>
42           View the diff from clang-format:
43           </summary>
45           \`\`\`diff
46           ${patch}
47           \`\`\`
49           </details>
50           `;
51           await github.rest.issues.createComment({
52             issue_number: context.issue.number,
53             owner: context.repo.owner,
54             repo: context.repo.repo,
55             body: comment
56           });