-
Notifications
You must be signed in to change notification settings - Fork 9
#2378: update .clang-format to match style guidelines
#2379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: PR checks (clang-format) | ||
|
|
||
| on: pull_request | ||
|
|
||
| jobs: | ||
| check: | ||
| name: Run clang-format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| - name: Run clang-format | ||
| run: | | ||
| { | ||
| echo 'CLANG_FORMAT_DIFF<<EOF' | ||
| git clang-format-16 --diff origin/${{ github.base_ref }} || true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense! |
||
| echo EOF | ||
| } >> "$GITHUB_ENV" | ||
| - uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script part boils down to:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is pretty much the same what |
||
| let commentId = -1 | ||
| for await (const { data: comments } of github.paginate.iterator( | ||
| github.rest.issues.listComments, { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number | ||
| } | ||
| )) { | ||
| const foundComment = comments.find((comment) => | ||
| comment.body.startsWith( | ||
| '`clang-format` output for this changeset:' | ||
| ) | ||
| ) | ||
| if (foundComment) { | ||
| commentId = foundComment.id | ||
| break | ||
| } | ||
| } | ||
| const { CLANG_FORMAT_DIFF } = process.env | ||
| const commentBody = '`clang-format` output for this changeset:\n```diff\n' + CLANG_FORMAT_DIFF + '\n```' | ||
| if (commentId === -1) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: commentBody | ||
| }) | ||
| } else { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: commentId, | ||
| body: commentBody | ||
| }) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.