forked from tier4/awsim_sensor_kit_launch
-
Notifications
You must be signed in to change notification settings - Fork 7
67 lines (57 loc) · 2.56 KB
/
clang-tidy-pr-comments.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# This file is automatically synced from:
# https://github.com/autowarefoundation/sync-file-templates
# To make changes, update the source repository and follow the guidelines in its README.
name: clang-tidy-pr-comments
on:
workflow_run:
workflows:
- build-and-test-differential
types:
- completed
jobs:
clang-tidy-pr-comments:
if: ${{ github.event.workflow_run.event == 'pull_request' && contains(fromJson('["success", "failure"]'), github.event.workflow_run.conclusion) }}
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Download analysis results
run: |
gh run download ${{ github.event.workflow_run.id }} -D /tmp || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if the fixes.yaml file exists
id: check-fixes-yaml-existence
uses: autowarefoundation/autoware-github-actions/check-file-existence@v1
with:
files: /tmp/clang-tidy-result/fixes.yaml
- name: Set variables
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
id: set-variables
run: |
echo "pr-id=$(cat /tmp/clang-tidy-result/pr-id.txt)" >> $GITHUB_OUTPUT
echo "pr-head-repo=$(cat /tmp/clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_OUTPUT
echo "pr-head-ref=$(cat /tmp/clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_OUTPUT
- name: Check out PR head
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
uses: actions/checkout@v3
with:
repository: ${{ steps.set-variables.outputs.pr-head-repo }}
ref: ${{ steps.set-variables.outputs.pr-head-ref }}
persist-credentials: false
- name: Replace paths in fixes.yaml
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
run: |
sed -i -e "s|/__w/|/home/runner/work/|g" /tmp/clang-tidy-result/fixes.yaml
cat /tmp/clang-tidy-result/fixes.yaml
- name: Copy fixes.yaml to access from Docker Container Action
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
run: |
cp /tmp/clang-tidy-result/fixes.yaml fixes.yaml
- name: Run clang-tidy-pr-comments action
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
uses: platisd/clang-tidy-pr-comments@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clang_tidy_fixes: fixes.yaml
pull_request_id: ${{ steps.set-variables.outputs.pr-id }}