]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish_format_check.yml
cb16b3278715aeb6b803f5fa52d1e10aa1f024c4
[stockfish] / .github / workflows / stockfish_format_check.yml
1 # This workflow will run clang-format and comment on the PR.
2 # Because of security reasons, it is crucial that this workflow
3 # executes no shell script nor runs make.
4 # Read this before editing: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
5
6 name: Stockfish
7 on:
8   pull_request_target:
9     branches:
10       - 'master'
11     paths:
12       - '**.cpp'
13       - '**.h'
14 jobs:
15   Stockfish:
16     name: clang-format check
17     runs-on: ubuntu-20.04
18     steps:
19       - uses: actions/checkout@v3
20         with:
21           ref: ${{ github.event.pull_request.head.sha }}
22
23       - name: Run clang-format style check
24         uses: jidicula/clang-format-action@f62da5e3d3a2d88ff364771d9d938773a618ab5e
25         id: clang-format
26         continue-on-error: true
27         with:
28           clang-format-version: '17'
29           exclude-regex: 'incbin'
30
31       - name: Comment on PR
32         if: steps.clang-format.outcome == 'failure'
33         uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308
34         with:
35           message: |
36             clang-format 17 needs to be run on this PR.
37             If you do not have clang-format installed, the maintainer will run it when merging.
38             For the exact version please see https://packages.ubuntu.com/mantic/clang-format-17.
39
40             _(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
41           comment_tag: execution
42
43       - name: Comment on PR
44         if: steps.clang-format.outcome != 'failure'
45         uses: thollander/actions-comment-pull-request@1d3973dc4b8e1399c0620d3f2b1aa5e795465308
46         with:
47           message: |
48             _(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
49           create_if_not_exists: false
50           comment_tag: execution
51           mode: delete