Skip to content

Commit 2f23e57

Browse files
authored
#15 update README.md and action.yml (#16)
* #15 update README.md and add result.png * #15 avoid duplicated checks on commits to open PRs * #15 update app's name and description
1 parent 98b1c15 commit 2f23e57

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Test action
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened]
47

58
jobs:
69
test:

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ Just create a `yml` file under your GitHub repository. For example `.github/work
1212
name: cpp-linter
1313

1414
# Triggers the workflow on push or pull request events
15-
on: [push, pull_request]
15+
on:
16+
push:
17+
pull_request:
18+
types: [opened]
1619
jobs:
1720
cpp-linter:
1821
name: cpp-linter
@@ -31,25 +34,24 @@ jobs:
3134
|------------|---------------|-------------|
3235
| style | 'llvm' | The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file. |
3336
| extensions | 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' | The file extensions to run the action against. This is a comma-separated string. |
34-
| tidy-checks | 'boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
37+
| tidy-checks | 'boost-\*,bugprone-\*,performance-\*,<br>readability-\*,portability-\*,<br>modernize-\*,clang-analyzer-\*,<br>cppcoreguidelines-\*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
3538
| repo-root | '.' | The relative path to the repository root directory. This path is relative to path designated by the runner's GITHUB_WORKSPACE environment variable. |
3639
| version | '10' | The desired version of the clang tools to use. Accepted options are strings which can be 6.0, 7, 8, 9, 10, 11, 12. |
3740
3841
### Outputs
3942
4043
This action creates 1 output variable named `checks-failed`. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's output to exit the workflow early if that is desired.
4144

42-
### Outputs
43-
44-
This action creates 1 output variable named `checks-failed`. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's output to exit the workflow early if that is desired.
4545
## Results of GitHub Actions
4646

47-
Here is a test repository [cpp-linter-action-demo](https://github.com/shenxianpeng/cpp-linter-action-demo) which has added `cpp-linter.yml`. when an unformatted C/C++ source file was committed and create a Pull Request will automatically recognize and add warning comments.
47+
![github-actions bot](./demo/result.png)
48+
49+
Behind the scenes, this is because this repository has added `test.yml` under `.github/workflows/`. When an unformatted C/C++ source file was committed and create a Pull Request will automatically recognize and add warning comments.
4850

49-
For example, this PR [#7](https://github.com/shenxianpeng/cpp-linter-action-demo/pull/7), and warning message like below:
51+
Please feel free to commit code to the `test` branch of this repository or create a Pull Request to see how the process works.
5052

51-
![github-actions bot](https://github.com/shenxianpeng/cpp-linter-action-demo/blob/master/img/result.png?raw=true)
53+
For example, this test PR [#6](https://github.com/shenxianpeng/cpp-linter-action/pull/5) and github-actions bot comments [link](https://github.com/shenxianpeng/cpp-linter-action/pull/5#commitcomment-55252014).
5254

53-
Please feel free to commit code to the [demo](https://github.com/shenxianpeng/cpp-linter-action-demo) repository and create a Pull Request to see how the process works.
55+
## Contribution
5456

5557
If you have any suggestions or contributions, welcome to PR [here](https://github.com/shenxianpeng/cpp-linter-action).

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: C/C++ code linter (clang-tidy and clang-format)
2-
description: Automatically checks pull requests changes with clang-tidy, clang-format and posts the comment with result.
1+
name: C/C++ Lint Action
2+
description: Automatically checks push & pull request changes with clang-format & clang-tidy, then posts a comment with faulty results.
33
author: shenxianpeng
44
branding:
55
icon: 'check-circle'

demo/result.png

53.5 KB
Loading

0 commit comments

Comments
 (0)