#2491: debug: convert first argument of string concat to a explicit string #428
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | | |
| git clang-format-16 --diff origin/${{ github.base_ref }} > clang-format.diff || true | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| 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 fs = require("fs") | |
| var output = fs.readFileSync("clang-format.diff", "utf8") | |
| // make sure not to exceed maximum length of the comment | |
| output = (output.length > 65000) ? | |
| output.substring(0, 65000) + '\n(...)' : output | |
| const commentBody = | |
| '`clang-format` output for this changeset:\n```diff\n' + | |
| output + '\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 | |
| }) | |
| } |