Skip to content

Commit fe9d05b

Browse files
authored
ci: add clang-tidy-pr-comments.yaml (#375)
* ci: add clang-tidy-pr-comments.yaml Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * use gh run Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * copy fixes.yaml Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp> * replace paths Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
1 parent 2af2183 commit fe9d05b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: clang-tidy-pr-comments
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- build-and-test-differential
7+
types:
8+
- completed
9+
10+
jobs:
11+
clang-tidy-pr-comments:
12+
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v2
17+
18+
- name: Download analysis results
19+
run: |
20+
gh run download ${{ github.event.workflow_run.id }} -D /tmp
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Set variables
25+
id: set-variables
26+
run: |
27+
echo ::set-output name=pr-id::"$(cat /tmp/clang-tidy-result/pr-id.txt)"
28+
echo ::set-output name=pr-head-repo::"$(cat /tmp/clang-tidy-result/pr-head-repo.txt)"
29+
echo ::set-output name=pr-head-ref::"$(cat /tmp/clang-tidy-result/pr-head-ref.txt)"
30+
31+
- name: Check out PR head
32+
uses: actions/checkout@v2
33+
with:
34+
repository: ${{ steps.set-variables.outputs.pr-head-repo }}
35+
ref: ${{ steps.set-variables.outputs.pr-head-ref }}
36+
persist-credentials: false
37+
38+
- name: Replace paths in fixes.yaml
39+
run: |
40+
sed -i -e "s|/__w/|/home/runner/work/|g" /tmp/clang-tidy-result/fixes.yaml
41+
cat /tmp/clang-tidy-result/fixes.yaml
42+
43+
- name: Copy fixes.yaml to access from Docker Container Action
44+
run: |
45+
cp /tmp/clang-tidy-result/fixes.yaml fixes.yaml
46+
47+
- name: Run clang-tidy-pr-comments action
48+
uses: platisd/clang-tidy-pr-comments@1.1.6
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
51+
clang_tidy_fixes: fixes.yaml
52+
pull_request_id: ${{ steps.set-variables.outputs.pr-id }}

0 commit comments

Comments
 (0)