Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Jun 2, 2024
1 parent a10e032 commit 05ee19b
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

permissions:
contents: read
pull-requests: write

jobs:
format_code:
Expand All @@ -21,6 +22,32 @@ jobs:
clangformat: 17.0.5

- name: Run clang-format
id: clang_format
run: |
find include src -name '*.h' -o -name '*.cc' | xargs clang-format -i -style=file -fallback-style=none
git diff --exit-code
git diff | tee fmt.patch
if [ -s fmt.patch ]; then
exit 1
fi
- uses: actions/github-script@v7
if: failure() && steps.clang_format.outcome == 'failure'
with:
script: |
const fs = require('fs');
const patch = fs.readFileSync('fmt.patch', { encoding: 'utf8' });
const comment = `clang-format 17.0.5 found issues in the formatting in your code:
<details>
<summary>
View the diff from clang-format:
</summary>
\`\`\`diff
${patch}
\`\`\`
</details>
`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});

0 comments on commit 05ee19b

Please sign in to comment.