-
Notifications
You must be signed in to change notification settings - Fork 6
/
action.yml
70 lines (68 loc) · 2.03 KB
/
action.yml
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
68
69
70
# action.yml
name: "cppcheck and review"
author: myml
branding:
icon: "check"
color: "black"
description: "check pull request with cppcheck and post result to review comments"
inputs:
github_token:
description: "action github token"
required: false
repository:
description: "owner and repository name"
required: true
pull_request_id:
description: "pull request id"
required: true
allow_approve:
description: "allow submit approve review"
required: true
default: true
enable_checks:
description: "checks to enable"
required: true
default: "all"
install_cppcheck:
description: "install cppcheck by apt"
required: false
default: true
comment_result:
description: "submit the result in a comment"
required: false
default: true
enable_qtcheck:
description: "qt code style check swith"
required: false
default: true
runs:
using: "composite"
steps:
- name: install cppcheck
if: inputs.install_cppcheck == 'true'
shell: bash
run: |
sudo apt-get install -y -q cppcheck
- name: run cppcheck
shell: bash
run: |
if [ ${{ inputs.enable_qtcheck }} = true ];then
if [ ! -e .qt.cfg ]; then wget -O .qt.cfg https://raw.githubusercontent.com/linuxdeepin/action-cppcheck/main/config/qt.cfg; fi
cppcheck --library=.qt.cfg --enable=${{ inputs.enable_checks }} --suppress='*:*3rdparty*' --output-file=report.xml --xml .
else
cppcheck --enable=${{ inputs.enable_checks }} --suppress='*:*3rdparty*' --output-file=report.xml --xml .
fi
- name: install golang
uses: actions/setup-go@v3
with:
go-version: ^1.17.1
- name: install action-cppcheck
shell: bash
run: |
cd $GITHUB_ACTION_PATH
go build ./cmd/action-cppcheck
- name: command
shell: bash
run: $GITHUB_ACTION_PATH/action-cppcheck -f=report.xml -repo=${{ inputs.repository }} -pr=${{ inputs.pull_request_id }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}